Module OSCCache
source code
Caching API for Storage Connect plug-ins.
Some of the operations provided by storage servers are very expensive.
They can take seconds or more to complete. Since they often need to be
repeated, it makes sense to cache responses for a limited period of
time.
Any object may serve as a cache as long as it provides the following
API:
set(ss_uuid, key, value, expire_seconds=30)
- Stores a value for expire_seconds
get(ss_uuid, key)
- Returns the value for key, or None if key has expired or was
never stored
extend(ss_uuid, key, extend_seconds)
- Extends the expire time for key; does nothing if key has already
expired
clear(ss_uuid)
- Drops all keys for ss_uuid