SqliteCacheManager

class privex.helpers.cache.post_deps.SqliteCacheManager(db: str = None, isolation_level=None, **kwargs)[source]
__init__(db: str = None, isolation_level=None, **kwargs)
Parameters
  • db (str) – Relative / absolute path to SQLite3 database file to use.

  • isolation_level – Isolation level for SQLite3 connection. Defaults to None (autocommit). See the Python SQLite3 Docs for more information.

Key int db_timeout

Amount of time to wait for any SQLite3 locks to expire before giving up

Key str query_mode

Either 'flat' (query returns tuples) or 'dict' (query returns dicts). More details in PyDoc block under query_mode

Key bool memory_persist

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::memory:?cache=shared'

property conn

Get or create an SQLite3 connection using DB file db and return it

make_connection(*args, **kwargs)sqlite3.Connection[source]

Creates a database connection using connector_func, passing all arguments/kwargs directly to the connector function.

Return GenericConnection conn

A database connection object, which should implement at least the basic connection object methods as specified in the Python DB API (PEP 249), and in the Protocol type class GenericConnection

Methods

Methods

cache_key_exists(name)

close([clean_all, thread_id])

delete_cache_key(name)

find_cache_key(name)

get_cache_all()

insert_cache_key(name, value[, …])

make_connection(*args, **kwargs)

Creates a database connection using connector_func, passing all arguments/kwargs directly to the connector function.

purge_expired()

set_cache_key(name, value[, expires_secs, …])

update_cache_key(name, value[, …])

Attributes

Attributes

DEFAULT_DB

DEFAULT_DB_FOLDER

DEFAULT_DB_NAME

SCHEMAS

cache_builder

conn

Get or create an SQLite3 connection using DB file db and return it