ConcurrentCacher
- class coba.context.ConcurrentCacher
A cacher that is multiprocess safe.
Constructors
- __init__(cache: Cacher[_K, _V], list: Sequence | None = None, lock: allocate_lock | None = None)
Instantiate a ConcurrentCacher.
- Parameters:
cache – Base cacher to make read/write safe across multiple processes.
list – Shared memory object that allows tracking of read/write locks.
lock – Synchronization object to be used to ensure read/write safety.
Methods
- get_set(key: _K, getter: Callable[[], _V] | _V) ContextManager[_V]
Get a key from the cache.
If the key is not in the cache put it first using getter.
- Parameters:
key – The key to get from the cache.
getter – A method for getting the value if necessary.
- rmv(key: _K)
Remove a key from the cache.
- Parameters:
key – The key to remove from the cache.