OneAndDone.Cache behaviour (One and Done v0.1.6)

View Source

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.

Summary

Callbacks

Retreive a value from the cache.

Store a value in the cache under the given key.

Callbacks

get(key)

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

Retreive a value from the cache.

put(key, value, opts)

@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.