collective.redismemoize.chooser

Contents

collective.redismemoize.chooser#

The ICacheChooser this package registers.

The ICacheChooser utility this package registers.

plone.memoize.ram.cache and plone.app.caching's RAM page cache both ask the ICacheChooser utility for a mapping per function. Stock Plone answers with a RAMCacheAdapter over the process-local global_cache; choose_cache() answers the same, except for a configured function that may use Redis.

The settings are read when this module is imported, which happens while the ZCML loads: an invalid variable stops the process at startup, not at the first request.

collective.redismemoize.chooser.choose_cache(fun_name)[source]#

Return the cache for one function.

Parameters:

fun_name (str) -- Dotted name of the cached function.

Returns:

The stock RAM adapter when the package is not configured or the function is excluded; a RedisCacheAdapter otherwise.

Return type:

AbstractDict