cache
Generic in-memory object caches.
This module provides two classes for in-memory object caching: ThreadSafeCache and AsyncCache. ThreadSafeCache is a simple thread-safe cache implementation, while AsyncCache is designed to work with asyncio.
Example
Classes
AsyncCache
ThreadSafeCache
Functions
get_cache_instance
get_cache_instance() -> Union[ThreadSafeCache, AsyncCache]
Determines whether to use the synchronous or asynchronous version of the cache based on whether an asyncio event loop is running.
Returns:
-
Union[ThreadSafeCache, AsyncCache]
–Union[ThreadSafeCache, AsyncCache]: The cache instance.