Skip to main content

NullCache.transact()

A no-op context manager that yields this NullCache.

Usage

Source

NullCache.transact(
    retry=False,
    *,
    key=None,
)

It never opens a transaction on an invalidate= cache: removals forwarded inside the block land at once, and an exception in the block doesn’t undo them.

Parameters

retry: bool = False

Accepted for Cache.transact()’s signature; it must be a bool.

key: str | None = None
Accepted so a switched-off sharded cache’s transact(key=...) works too; it must be a str or None.

Raises

TypeError
retry isn’t a bool, or key isn’t a str or None.