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:
|
| 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:
|
value
|
The data to be saved.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
None
|
None |