ExExample.Cache (ExExample v0.1.2)

View Source

I define logic to store and retrieve results from the cache.

Summary

Functions

I clear the entire cache.

I fetch a previous Result from the cache if it exists. If it does not exist, I return {:error, :not_found}.

I store a result in cache for a given key.

I return the state of the last execution of an example.

Functions

clear()

@spec clear() :: :ok

I clear the entire cache.

get_result(key)

@spec get_result(ExExample.Cache.Key.t()) ::
  {:ok, ExExample.Cache.Result.t()} | {:error, :no_result}

I fetch a previous Result from the cache if it exists. If it does not exist, I return {:error, :not_found}.

put_result(result, key)

@spec put_result(ExExample.Cache.Result.t(), ExExample.Cache.Key.t()) ::
  {atom(), boolean()}

I store a result in cache for a given key.

state(key)

@spec state(ExExample.Cache.Key.t() | {atom(), atom()}) ::
  :succeeded | :failed | :skipped

I return the state of the last execution of an example.