collective.redismemoize.api#
Invalidation, status, and a decorator with its own TTL. This is the module add-ons call.
Public API: invalidation, status, and a decorator with its own TTL.
Nothing in this package calls invalidate_all() on its own. Call it when
the meaning of cached values changes for every instance at once, typically
after a deploy that changes what a cached function returns, or from an
upgrade step.
- collective.redismemoize.api.BATCH_SIZE = 500#
How many keys one
SCANstep asks for, and oneUNLINKremoves.
- collective.redismemoize.api.ram_caches()[source]#
Return the RAM caches
plone.memoizemay have stored values in.The chooser wraps the
IRAMCacheutility, whilestore_in_cachefalls back toglobal_cachewhen no chooser is registered. They are usually the same object, but not always: a test layer can register its own.
- collective.redismemoize.api.invalidate(fun_name)[source]#
Drop every cached value of one function, in Redis and in RAM.
- collective.redismemoize.api.invalidate_all()[source]#
Drop every cached value under the prefix, and the whole RAM cache.
- Returns:
How many Redis keys were removed.
- Return type:
- collective.redismemoize.api.status()[source]#
Describe the configuration, the breaker, the server and the routes.
This contacts Redis (a
PINGand anINFO server) even while the breaker is open, so it reports the server's current state.
- collective.redismemoize.api.cache(get_key, ttl=None)[source]#
Decorate a function like
plone.memoize.ram.cache, with its own TTL.The value goes through the same chooser, serializer and routing as any other cached function;
ttlonly matters when it ends up in Redis.- Parameters:
- Returns:
The decorator.
- Raises:
ValueError -- When
ttlis not a positive integer.- Return type: