TransactionalCacheLike
A CacheLike with transact(), which Cache and NullCache both have.
Usage
TransactionalCacheLike()On a Cache, with cache.transact() as tx: runs the block’s calls on this thread in one write transaction; tx is the cache. On a NullCache it’s a no-op that yields the NullCache.
Examples
from diskcache_oxide import TransactionalCacheLike
def count(cache: TransactionalCacheLike, path: str) -> None:
with cache.transact() as tx:
tx.incr('requests')
tx.incr(f'requests:{path}')Methods
| Name | Description |
|---|---|
| transact() | A context manager holding a write transaction for the block, yielding the cache. |
transact()
A context manager holding a write transaction for the block, yielding the cache.
Usage
transact(retry=False)