z_depcache (zotonic_core v1.0.0-rc.17)
z_depcache interface file for handing depcache functions from the Zotonic context.
Summary
Functions
Flush all keys from the caches
Flush the key and all keys depending on the key
Flush all items memoized in the process dictionary.
Fetch the key from the cache, return the data or an undefined if not found (or not valid)
Fetch the key from the cache, return the data or an undefined if not found (or not valid)
Fetch the key from the cache, return the data or an undefined if not found (or not valid)
Fetch the key from the cache, when the key does not exist then lock the entry and let the calling process insert the value. All other processes requesting the key will wait till the key is updated and receive the key's new value.
Enable or disable the in-process caching using the process dictionary
Check if we use a local process dict cache
Add the key to the depcache, hold it for 3600 seconds and no dependencies
Add the key to the depcache, hold it for MaxAge seconds and no dependencies
Add the key to the depcache, hold it for MaxAge seconds and check the dependencies
Return the total memory size of all stored terms
Start depcache instance based on site configuration
Functions
-spec flush(Context) -> ok when Context :: z:context().
Flush all keys from the caches
Flush the key and all keys depending on the key
-spec flush_process_dict() -> ok.
Flush all items memoized in the process dictionary.
-spec get(Key, Context) -> {ok, Data} | undefined when Key :: any(), Context :: z:context(), Data :: any().
Fetch the key from the cache, return the data or an undefined if not found (or not valid)
-spec get(Key, SubKey, Context) -> {ok, Data} | undefined when Key :: any(), SubKey :: any(), Context :: z:context(), Data :: any().
Fetch the key from the cache, return the data or an undefined if not found (or not valid)
-spec get_subkey(Key, SubKey, Context) -> {ok, Data} | undefined when Key :: any(), SubKey :: any(), Context :: z:context(), Data :: any().
Fetch the key from the cache, return the data or an undefined if not found (or not valid)
-spec get_wait(Key, Context) -> Result when Key :: any(), Context :: z:context(), Data :: any(), Result :: {ok, Data} | undefined | {throw, term()} | {error, term()}.
Fetch the key from the cache, when the key does not exist then lock the entry and let the calling process insert the value. All other processes requesting the key will wait till the key is updated and receive the key's new value.
Enable or disable the in-process caching using the process dictionary
Check if we use a local process dict cache
Add the key to the depcache, hold it for 3600 seconds and no dependencies
-spec set(Key, Data, MaxAge, Context) -> ok when Key :: any(), Data :: any(), MaxAge :: non_neg_integer(), Context :: z:context().
Add the key to the depcache, hold it for MaxAge seconds and no dependencies
-spec set(Key, Data, MaxAge, Depend, Context) -> ok when Key :: any(), Data :: any(), MaxAge :: non_neg_integer(), Depend :: [Key], Context :: z:context().
Add the key to the depcache, hold it for MaxAge seconds and check the dependencies
-spec size(Context) -> non_neg_integer() | undefined when Context :: z:context().
Return the total memory size of all stored terms
Start depcache instance based on site configuration