Nebulex v2.0.0-rc.0 Nebulex.Entry View Source
Defines a Cache Entry.
This is the structure used by the caches for representing cache entries.
Link to this section Summary
Functions
Decodes a previously encoded entry.
Encodes a cache entry.
Returns whether the given entry
has expired or not.
Returns the remaining time-to-live.
Link to this section Types
Specs
t() :: %Nebulex.Entry{ key: any(), time_unit: System.time_unit(), touched: integer(), ttl: timeout(), value: any() }
Link to this section Functions
Specs
Decodes a previously encoded entry.
Example
iex> %Nebulex.Entry{}
...> |> Nebulex.Entry.encode()
...> |> Nebulex.Entry.decode()
_decoded_entry
Specs
Encodes a cache entry.
Example
iex> Nebulex.Entry.encode(%Nebulex.Entry{})
_encoded_entry
Specs
Returns whether the given entry
has expired or not.
Example
iex> Nebulex.Entry.expired?(%Nebulex.Entry{})
false
Specs
Returns the remaining time-to-live.
Example
iex> Nebulex.Entry.ttl(%Nebulex.Entry{})
:infinity