Skip to content

SQLite Cache

SQLiteCache(path: Path | None = None, expiry: int | None = 14)

The SQLiteCache object to cache search results from Comicvine.

PARAMETER DESCRIPTION
path

Path to database.

TYPE: Path | None DEFAULT: None

expiry

How long to keep cache results.

TYPE: int | None DEFAULT: 14

Functions

cleanup() -> None

Remove all expired entries from the cache database.

delete(query: str) -> None

Remove entry from the cache with the provided url.

PARAMETER DESCRIPTION
query

Url string used as key.

TYPE: str

initialize() -> None

Create the cache table if it doesn't exist.

insert(query: str, response: dict[str, Any]) -> None

Insert data into the cache database.

PARAMETER DESCRIPTION
query

Url string used as key.

TYPE: str

response

Response dict from url.

TYPE: dict[str, Any]

select(query: str) -> dict[str, Any]

Retrieve data from the cache database.

PARAMETER DESCRIPTION
query

Url string used as key.

TYPE: str

RETURNS DESCRIPTION
dict[str, Any]

Empty dict or select results.