View Source OneAndDone.Cache behaviour (One and Done v0.1.5)

Defines the most basic cache interface.

This module is used as a reference for Cache implementations. Although not used by OneAndDone, Cache implementations should be compliant with this module.

This module is compliant with Nebulex.Cache. If you use Nebulex, you are already compliant with this module.

Link to this section Summary

Callbacks

Retreive a value from the cache.

Store a value in the cache under the given key.

Link to this section Callbacks

@callback get(key :: any()) :: any() | nil

Retreive a value from the cache.

@callback put(key :: any(), value :: any(), opts :: [{:ttl, pos_integer()}]) :: :ok

Store a value in the cache under the given key.

Opts must include a TTL, given in milliseconds.