Class TimeSpanExtensions
Inherited Members
Namespace: Couchbase.Utils
Assembly: Couchbase.NetClient.dll
Syntax
public static class TimeSpanExtensions
Methods
| Edit this page View SourceGetSeconds(TimeSpan)
Declaration
public static uint GetSeconds(this TimeSpan timeSpan)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeSpan | The timespan. |
Returns
Type | Description |
---|---|
uint | An uint that is the total number of seconds in the TimeSpan. |
ToTtl(TimeSpan)
Converts a TimeSpan into an uint correctly representing a Time-To-Live, that is expressed in seconds. Durations strictly bigger than 30 days are converted to a unix-syle timestamp (seconds since the Epoch), as described in the couchbase TTL documentation.
Declaration
public static uint ToTtl(this TimeSpan duration)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | duration |
Returns
Type | Description |
---|---|
uint | The TTL, expressed as a suitable uint. |
ToTtl(uint)
Converts a duration expressed as milliseconds to a unix-based TTL.
Declaration
public static uint ToTtl(this uint duration)
Parameters
Type | Name | Description |
---|---|---|
uint | duration | Milliseconds to use as TTL. |
Returns
Type | Description |
---|---|
uint | The TTL, expressed as a unix-based TTL in milliseconds. |