SQLite Cache
SQLiteCache(path: str = get_cache_root() / 'cache.sqlite', expiry: Optional[int] = 14)
The SQLiteCache object to cache search results from ComicVine.
PARAMETER | DESCRIPTION |
---|---|
path |
Path to database.
TYPE:
|
expiry |
How long to keep cache results.
TYPE:
|
ATTRIBUTE | DESCRIPTION |
---|---|
expiry |
How long to keep cache results.
TYPE:
|
con |
Database connection
TYPE:
|
cur |
Database cursor
TYPE:
|
Functions
delete()
Remove all expired data from the cache database.
get(key: str) -> Optional[Dict[str, Any]]
Retrieve data from the cache database.
PARAMETER | DESCRIPTION |
---|---|
key |
Search string
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[Dict[str, Any]]
|
None or select results. |
insert(query: str, response: str)
Insert data into the cache database.
PARAMETER | DESCRIPTION |
---|---|
query |
Search string
TYPE:
|
response |
Data to save
TYPE:
|
select(query: str) -> Dict[str, Any]
Retrieve data from the cache database.
PARAMETER | DESCRIPTION |
---|---|
query |
Search string
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Dict[str, Any]
|
Empty dict or select results. |
store(key: str, value: str)
Insert data into the cache database.
PARAMETER | DESCRIPTION |
---|---|
key |
Search string
TYPE:
|
value |
Data to save
TYPE:
|