ConCache.fetch_or_store
You're seeing just the function
fetch_or_store
, go back to ConCache module for more information.
Specs
fetch_or_store(t(), key(), fetch_or_store_fun()) :: {:ok, value()} | {:error, any()}
Retrieves the item from the cache, or inserts the new item.
If the item exists in the cache, it is retrieved. Otherwise, the lambda
function is executed and its result is stored under the given key, but only if
it returns an {:ok, value}
tuple. If the {:error, reason}
tuple is returned,
caching is not done and the error becomes the result of the function. If the lambda
returns none of the above, a RuntimeError
is raised.
The lambda may return either a plain value or %ConCache.Item{}
.
This function is not supported by :bag
and :duplicate_bag
ETS tables.
Note: if the item is already in the cache, this function amounts to a simple get without any locking, so you can expect it to be fairly fast.