View Source Glific.Caches (Glific v5.1.6)

Glific Cache management

Link to this section Summary

Functions

Get a cached value based on a key with fallback

Get a cached value based on a key

Retrieve a global value from the cache global scope

Set a global value, ttl is in number of hours For global keys, we expect relatively short ttls

Remove a value from the cache

Link to this section Functions

Link to this function

fetch(organization_id, key, fallback_fn)

View Source
@spec fetch(non_neg_integer(), any(), (any() -> any())) ::
  {:ok | :error | :commit | :ignore, any()}

Get a cached value based on a key with fallback

Link to this function

get(organization_id, key, opts \\ [])

View Source
@spec get(non_neg_integer(), any(), Keyword.t()) :: {:ok, any()} | {:ok, false}

Get a cached value based on a key

@spec get_global(any()) :: {:ok | :error, any()}

Retrieve a global value from the cache global scope

Link to this function

put_global(key, value, ttl)

View Source
@spec put_global(any(), any(), non_neg_integer()) :: {:ok | :error, boolean()}

Set a global value, ttl is in number of hours For global keys, we expect relatively short ttls

Link to this function

remove(organization_id, keys)

View Source
@spec remove(non_neg_integer(), list()) :: any()

Remove a value from the cache