ahvn.cache.mongo_cache module¶
MongoDB-based cache backend.
- class ahvn.cache.mongo_cache.MongoCache(database=None, collection=None, exclude=None, *args, **kwargs)[source]¶
Bases:
BaseCacheAn implementation of BaseCache that stores data in a MongoDB collection. Each cache entry is stored as a document with an integer _id (cache key) and a content field (JSON data).
- __init__(database=None, collection=None, exclude=None, *args, **kwargs)[source]¶
Initialization.
- Parameters:
database (Optional[str]) – MongoDB database name.
collection (Optional[str]) – MongoDB collection name for cache storage.
exclude (Optional[Iterable[str]]) – Keys to exclude from inputs when creating cache entries.
*args – Additional positional arguments.
**kwargs – Additional keyword arguments for MongoDB connection.