Skip to content

Sqlite_Cache

SqliteCache(db_name: str = 'mokkari_cache.db', expire: int | None = None)

A class for caching data using SQLite.

METHOD DESCRIPTION
- __init__

Initializes a new SqliteCache.

- get

Retrieve data from the cache database.

- store

Save data to the cache database.

- cleanup

Remove any expired data from the cache database.

- _determine_expire_str

Determine the expiration date string for cache data.

Initialize a new SqliteCache.

Functions

cleanup() -> None

Remove any expired data from the cache database.

get(key: str) -> Any | None

Retrieve data from the cache database.

PARAMETER DESCRIPTION
key

A string representing the value to search for.

TYPE: str

RETURNS DESCRIPTION
Any | None

The retrieved data if found, or None if not found.

store(key: str, value: str) -> None

Save data to the cache database.

PARAMETER DESCRIPTION
key

A string representing the item id.

TYPE: str

value

The data to be saved.

TYPE: str

RETURNS DESCRIPTION
None

None