pip_services3_components.cache.NullCache module

pip_services3_components.cache.NullCache

Null cache component implementation

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_components.cache.NullCache.NullCache

Bases: pip_services3_components.cache.ICache.ICache

Dummy cache implementation that doesn’t do anything.

It can be used in testing or in situations when cache is required but shall be disabled.

remove(correlation_id: Optional[str], key: str)

Removes a value from the cache by its key.

Parameters
  • correlation_id – (optional) transaction id to trace execution through call chain.

  • key – a unique value key.

retrieve(correlation_id: Optional[str], key: str) → Any

Retrieves cached value from the cache using its key. If value is missing in the cache or expired it returns None.

Parameters
  • correlation_id – (optional) transaction id to trace execution through call chain.

  • key – a unique value key.

Returns

a cached value or None if value wasn’t found or timeout expired.

store(correlation_id: Optional[str], key: str, value: Any, timeout: int) → Any

Stores value in the cache with expiration time.

Parameters
  • correlation_id – (optional) transaction id to trace execution through call chain.

  • key – a unique value key.

  • value – a value to store.

  • timeout – expiration timeout in milliseconds.

Returns

a cached value stored in the cache.