Skip to main content

Cache.touch()

Change the expiry of an existing entry without rewriting its value.

Usage

Source

Cache.touch(
    key,
    expire=None,
    *,
    retry=False,
)

Parameters

key: Key

The key.

expire: Optional[float] = None

Seconds from now until the entry expires, or None to make it never expire.

retry: bool = False
On a Timeout, try again until the call gets through, each round with the whole timeout, a durable=True handle included. Only Timeout is retried.

Returns

bool

True if the entry existed and was updated, False if it was missing or expired, or with

durable=True, if the call failed.

Raises

Timeout
Another process held the write lock for longer than timeout.

Examples

cache.touch('session:xyz', expire=1800)   # 30 more minutes, if it's still there