aries_cloudagent.cache package

Submodules

aries_cloudagent.cache.base module

Abstract base classes for cache.

class aries_cloudagent.cache.base.BaseCache[source]

Bases: abc.ABC

Abstract cache interface.

clear(key: str)[source]

Remove an item from the cache, if present.

Parameters:key – the key to remove
flush()[source]

Remove all items from the cache.

get(key: str)[source]

Get an item from the cache.

Parameters:key – the key to retrieve an item for
Returns:The record found or None
set(key: str, value: Any, ttl: int)[source]

Add an item to the cache with an optional ttl.

Parameters:
  • key – the key to set an item for
  • value – the value to store in the cache
  • ttl – number of second that the record should persist

aries_cloudagent.cache.basic module

Basic in-memory cache implementation.

class aries_cloudagent.cache.basic.BasicCache[source]

Bases: aries_cloudagent.cache.base.BaseCache

Basic in-memory cache class.

clear(key: str)[source]

Remove an item from the cache, if present.

Parameters:key – the key to remove
flush()[source]

Remove all items from the cache.

get(key: str)[source]

Get an item from the cache.

Parameters:key – the key to retrieve an item for
Returns:The record found or None
set(key: str, value: Any, ttl: int = None)[source]

Add an item to the cache with an optional ttl.

Overwrites existing cache entries.

Parameters:
  • key – the key to set an item for
  • value – the value to store in the cache
  • ttl – number of seconds that the record should persist