SQLite3 Cache
pip install sqlite3-cache
Documentation: https://mrthearman.github.io/sqlite3-cache/
Source Code: https://github.com/MrThearMan/sqlite3-cache/
Contributing: https://github.com/MrThearMan/sqlite3-cache/blob/main/CONTRIBUTING.md
Use SQLite3 as quick, persistent, thread-safe cache. Can store any picklable objects.
from sqlite3_cache import Cache
cache = Cache()
Quickstart
Interface works similarly to Django's cache interface
with a few additions. Values stay in the cache even if the given timeout
is reached, and only get deleted on the next call to clear
, or any of these methods:
get
, get_or_set
, get_many
, delete
, delete_many
, ttl
, or ttl_many
for that key.
Supports indexing:
cache["key"] = "value"
cache["key"]
del cache["key"]
Supports membership test:
"key" in cache
Can be used as a context manager:
with Cache() as cache: ...