View Source Flowy.Support.Cache.Store behaviour (Flowy v0.1.0)

A behaviour for cache stores.

Summary

Callbacks

@callback delete(key :: String.t()) :: {:error, :not_found} | {:ok, :deleted}
@callback fetch(key :: String.t(), fnc :: (... -> any()), opts :: keyword()) ::
  {:ok, any()} | {:error, :expired | :not_found}
@callback read(key :: String.t(), opts :: keyword()) ::
  {:ok, any()} | {:error, :expired | :not_found}
@callback reset() :: true
@callback write(key :: String.t(), value :: any()) :: {:ok, any()}