View Source Lexical.ProcessCache (lexical_shared v0.5.0)

A simple cache with a timeout that lives in the process dictionary

Link to this section Summary

Functions

Retrieves a value from the cache If the value is not found, the default is returned

Retrieves a value from the cache If the value is not found, the default is returned

Retrieves and optionally sets a value in the cache.

Link to this section Types

@type fetch_result() :: {:ok, term()} | :error
@type key() :: term()

Link to this section Functions

@spec fetch(key()) :: fetch_result()

Retrieves a value from the cache If the value is not found, the default is returned

Link to this function

get(key, default \\ nil)

View Source
@spec get(key(), term()) :: term() | nil

Retrieves a value from the cache If the value is not found, the default is returned

Link to this function

trans(key, timeout_ms \\ 5000, compute_fn)

View Source

Retrieves and optionally sets a value in the cache.

Trans looks up a value in the cache under key. If that value isn't found, the compute_fn is then executed, and its return value is set in the cache. The cached value will live in the cache for timeout milliseconds

Link to this macro

with_cleanup(list)

View Source (macro)