"""Please be aware that the Cache classes are not thread-safe. Access to a shared cache from multiple threads must be properly synchronized, e.g. by using one of the memoizing decorators with a suitable lock object. To avoid potential issues, a 1:1 cache:function ratio has been implemented. Notes: TTLCache is an LRU Cache implementation with per-item time-to-live (TTL) value. """ from cachetools import TTLCache from delphi_api.const import ( AUTH0_KEY_SIG_CACHE_TTL, CLIENTS_LIST_CACHE_TTL, DEFAULT_CACHE_MAX_SIZE, DEFAULT_CACHE_TTL, RSA_KEY_CACHE_TTL, TRACING_CACHE_TTL, ) ClientsListCache = TTLCache(32, ttl=CLIENTS_LIST_CACHE_TTL) CompositeRangeCache = TTLCache(DEFAULT_CACHE_MAX_SIZE, DEFAULT_CACHE_TTL) ItemKeysCache = TTLCache(DEFAULT_CACHE_MAX_SIZE, DEFAULT_CACHE_TTL) TracingCache = TTLCache(64, TRACING_CACHE_TTL) Auth0KeySigCache = TTLCache(1, ttl=AUTH0_KEY_SIG_CACHE_TTL) RsaKeyCache = TTLCache(128, ttl=RSA_KEY_CACHE_TTL)