SQLite Cache
SQLiteCache(path: Path = get_cache_root() / 'cache.sqlite', expiry: Optional[int] = 14)
The SQLiteCache object caches results from TCGPlayer.
PARAMETER | DESCRIPTION |
---|---|
path |
Path to the database.
TYPE:
|
expiry |
How long to keep the cache results, in days.
TYPE:
|
ATTRIBUTE | DESCRIPTION |
---|---|
expiry |
How long to keep the cache results, in days.
TYPE:
|
con |
Database connection.
TYPE:
|
cur |
Database cursor.
TYPE:
|
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:
|
response |
Data to save.
TYPE:
|
select(query: str) -> Dict[str, Any]
Retrieve data from the cache.
PARAMETER | DESCRIPTION |
---|---|
query |
Search string.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Dict[str, Any]
|
Empty dict or results. |