Nebulex v1.2.2 Nebulex.Object View Source
Defines a Cache Object.
This is the struct used by the caches to store and retrieve data.
Link to this section Summary
Functions
Returns the UNIX timestamp in seconds for the given ttl.
Returns whether the given object has expired or not.
Returns the remaining time to live for the given timestamp.
Wrapper for DateTime.to_unix/2.
Link to this section Types
Specs
Link to this section Functions
Specs
Returns the UNIX timestamp in seconds for the given ttl.
Example
iex> expire_at = Nebulex.Object.expire_at(10)
iex> expire_at - Nebulex.Object.ts()
10 Specs
Returns whether the given object has expired or not.
Example
iex> Nebulex.Object.expired?(%Nebulex.Object{})
false Specs
Returns the remaining time to live for the given timestamp.
Example
iex> expire_at = Nebulex.Object.expire_at(10)
iex> Nebulex.Object.remaining_ttl(expire_at)
10 Specs
ts(datetime :: Calendar.datetime()) :: integer()
Wrapper for DateTime.to_unix/2.
Example
iex> 1_464_096_368 |> DateTime.from_unix!() |> Nebulex.Object.ts()
1464096368