speasy.core.cache package

speasy.core.cache.add_item(key, item, expires=None)[source]

Add an item to the cache with an optional expiration time in seconds

Parameters:
keystr

The key under which the item will be stored

itemany

The item to be stored

expiresint, optional

The expiration time in seconds, by default None (no expiration)

speasy.core.cache.cache_disk_size()[source]

Return the size of the cache on disk

speasy.core.cache.cache_len()[source]

Return the number of items in the cache

speasy.core.cache.drop_item(key)[source]

Drop an item from the cache by key

Parameters:
keystr

The key of the item to be dropped

speasy.core.cache.drop_matching_entries(pattern: str | Pattern)[source]

Drop all cache entries that match a given pattern

Parameters:
patternstr or re.Pattern

The pattern to match cache keys against

speasy.core.cache.entries()[source]

Return all cache entries as a list of keys

Returns:
list

A list of all cache keys

speasy.core.cache.get_item(key, default_value=None)[source]

Get an item from the cache by key

Parameters:
keystr

The key of the item to be retrieved

default_valueany, optional

The default value to return if the key does not exist, by default None

Returns:
any

The item stored under the key or the default value if the key does not exist

speasy.core.cache.stats()[source]

Submodules