Class TimeToLive
Namespace: Oracle.NoSQL.SDK
Assembly: Oracle.NoSQL.SDK.dll
Syntax
public sealed class TimeToLive : ValueType
Remarks
TTL is restricted to durations of days and hours, with day being 24 hours. TimeToLive may specify number of days or number of hours, but not both and may be created with methods OfDays(Int64) and OfHours(Int64).
Sometimes you may need to indicate explicitly that the record does not expire. This is needed when you perform a Put operation on existing record and want to remove its expiration. You may indicate no expiration by using the value DoNotExpire.
The record expiration time is determined as follows:
Records expire on day or hour boundaries, depending on whether
the TimeToLive instance is created with days or hours.
At the time of the Put operation, TTL
property is used to compute the record's expiration time by first
converting it from days (or hours) to milliseconds, and then adding it
to the current system time. If the resulting expiration time is not
evenly divisible by the number of milliseconds in one day (or hour),
it is rounded up to the nearest day (or hour). The day and hour
boundaries (the day boundary is at midnight) are considered in UTC
time zone.
The minimum TTL that can be specified is 1 hour. Because of the
rounding behavior described above, the actual record duration will be
longer than specified in the TTL (because of rounding up).
Using the duration of days is recommended as it will result in the least amount of storage overhead compared to the duration of hours.
Fields
Name | Description |
---|---|
DoNotExpire | Represents a special TTL value that indicates no expiration. |
Properties
Name | Description |
---|---|
TimeUnit | Gets the time unit used in this instance. |
Value | Gets the number of days or hours in this instance. |
Methods
Name | Description |
---|---|
FromExpirationTime(DateTime, Nullable<DateTime>, Nullable<TTLTimeUnit>) | Constructs TTL from absolute expiration time given reference time from which to measure record expiration. |
OfDays(Int64) | Creates TTL with duration of days. |
OfHours(Int64) | Creates TTL with duration of hours. |
ToExpirationTime(Nullable<DateTime>) | Converts TTL to absolute expiration time. |
ToString() | Returns the string representation of this instance. |