__init__¶
-
AsyncSqliteCache.__init__(db_file: str = None, memory_persist=False, use_pickle: bool = None, connection_kwargs: dict = None, *args, **kwargs)[source]¶ AsyncSqliteCacheuses an auto-generated database filename / path by default, based on the name of the currently running script ( retrieved fromsys.argv[0]), allowing for persistent caching - without any manual configuration of the adapter, nor the requirement for any running background services such asredis/memcached.- Parameters
db_file (str) – (Optional) Name of / path to Sqlite3 database file to create/use for the cache.
memory_persist (bool) – Use a shared in-memory database, which can be accessed by other instances of this class (in this process) - which is cleared after all memory connections are closed. Shortcut for
db_file='file::memory:?cache=shared'use_pickle (bool) – (Default:
True) Use the built-inpickleto serialise values before storing in Sqlite3, and un-serialise when loading from Sqlite3connection_kwargs (dict) – (Optional) Additional / overriding kwargs to pass to
sqlite3.connect()whenAsyncSqliteCacheManagerinitialises it’s sqlite3 connection.purge_every (int) – (Default: 300) Expired + abandoned cache records are purged using the DB manager method
AsyncSqliteCacheManager.purge_expired()duringget()/set()calls. To avoid performance issues, the actualAsyncSqliteCacheManager.purge_expired()method is only called if at leastpurge_everyseconds have passed since the last purge was triggered (last_purged_expired)