Types & Protocols¶
Most parts of psycache can be replaced by implementing the appropriate protocols.
psycache.typing.AsyncCachePool
¶
Bases: Protocol
Protocol for a class that provides a way to connect to a
psycopg.AsyncConnection.
Implemented by adapters that wrap a higher-level connection source
(for example, a psycopg pool or a SQLAlchemy engine) and hand
out an auto-commit psycopg.AsyncConnection.
connect()
¶
Connect to the database and return a context manager for an auto-commit connection.
psycache.typing.CacheCleanupSpan
¶
psycache.typing.CacheFlushSpan
¶
psycache.typing.CacheGetSpan
¶
psycache.typing.CacheInstrumentation
¶
Bases: Protocol
Cache instrumentation provider.
start_cache_cleanup_span()
¶
Start a span for a cache cleanup operation.
start_cache_flush_span()
¶
Start a span for a cache flush operation.
start_cache_get_span(key, name)
¶
Start a span for a cache get operation.
start_cache_put_span(key, name)
¶
Start a span for a cache put operation.
start_cache_remove_span(key)
¶
Start a span for a cache removal operation.
psycache.typing.CachePool
¶
Bases: Protocol
Protocol for a class that provides a way to connect to a
psycopg.Connection.
Implemented by adapters that wrap a higher-level connection source
(for example, a psycopg pool or a SQLAlchemy engine) and hand
out an auto-commit psycopg.Connection.
connect()
¶
Connect to the database and return a context manager for an auto-commit connection.