SQLite Cache

SQLiteCache(path: Path = get_cache_root() / 'cache.sqlite', expiry: Optional[int] = 14)

The SQLiteCache object caches results from CardTrader.

PARAMETER DESCRIPTION
path

Path to the database.

TYPE: Path DEFAULT: get_cache_root() / 'cache.sqlite'

expiry

How long to keep the cache results, in days.

TYPE: Optional[int] DEFAULT: 14

ATTRIBUTE DESCRIPTION
expiry

How long to keep the cache results, in days.

TYPE: Optional[timedelta]

con

Database connection.

TYPE: sqlite3.Connection

cur

Database cursor.

TYPE: sqlite3.Cursor

Functions

delete()

Remove all expired data from the cache.

insert(query: str, response: Dict[str, Any])

Insert data into the cache.

PARAMETER DESCRIPTION
query

Search string.

TYPE: str

response

Data to save.

TYPE: Dict[str, Any]

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

Retrieve data from the cache.

PARAMETER DESCRIPTION
query

Search string.

TYPE: str

RETURNS DESCRIPTION
Dict[str, Any]

Empty dict or results.