Skip to main content

Cache.reset()

Read size_limit, cull_limit or eviction_policy as stored now, or persist a new value and

Usage

Source

Cache.reset(
    key,
    value=...,
    update=True,
)

return it.

Parameters

key: bool

'size_limit', 'cull_limit' or 'eviction_policy'.

value: Any = …

The new value, checked as the constructor checks it; leave it out (or pass ENOVAL) to read. On a FanoutCache a size_limit is a total, split across the shards.

update: bool = True
Must be True: there’s no SQLite pragma to skip (diskcache’s update=False).

Returns

int | Literal[‘least-recently-stored’, ‘none’] | int | str
The setting: an int for a limit, the policy’s name for eviction_policy.

Raises

ValueError

Another key, update=False, or a value the constructor would refuse.

TypeError
A limit that isn’t an int, or a policy that isn’t a str.