{ "module": "mongo_ops.cache.backend", "content": { "path": "mongo_ops.cache.backend", "docstring": "# Summary\n\nCache backend abstraction.", "objects": { "CacheStats": { "name": "CacheStats", "kind": "class", "path": "mongo_ops.cache.backend.CacheStats", "signature": "CacheStats(hits: int = 0, misses: int = 0, sets: int = 0, deletes: int = 0, current_size: int = 0, max_size: int = 0)", "docstring": "Snapshot of cache usage and activity counters.\n\nAttributes:\n hits (int):\n Number of get() calls that found a value.\n misses (int):\n Number of get() calls that returned None.\n sets (int):\n Number of values written to the cache.\n deletes (int):\n Number of keys removed.\n current_size (int):\n Number of entries currently held.\n max_size (int):\n Maximum number of entries the cache allows (0 = unbounded).", "members": { "hits": { "name": "hits", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.hits", "signature": null, "docstring": null }, "misses": { "name": "misses", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.misses", "signature": null, "docstring": null }, "sets": { "name": "sets", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.sets", "signature": null, "docstring": null }, "deletes": { "name": "deletes", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.deletes", "signature": null, "docstring": null }, "current_size": { "name": "current_size", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.current_size", "signature": null, "docstring": null }, "max_size": { "name": "max_size", "kind": "attribute", "path": "mongo_ops.cache.backend.CacheStats.max_size", "signature": null, "docstring": null } } }, "CircularReferenceError": { "name": "CircularReferenceError", "kind": "class", "path": "mongo_ops.cache.backend.CircularReferenceError", "signature": "CircularReferenceError(collection: str, doc_id: ObjectId, path: list[str])", "docstring": "Raised when population detects a cycle in the reference graph.\n\nAttributes:\n collection (str):\n Collection where the cycle was detected.\n doc_id (ObjectId):\n Document ID where the cycle was detected.\n path (list[str]):\n Ordered labels describing the visited reference path.", "members": { "collection": { "name": "collection", "kind": "attribute", "path": "mongo_ops.cache.backend.CircularReferenceError.collection", "signature": null, "docstring": null }, "doc_id": { "name": "doc_id", "kind": "attribute", "path": "mongo_ops.cache.backend.CircularReferenceError.doc_id", "signature": null, "docstring": null }, "path": { "name": "path", "kind": "attribute", "path": "mongo_ops.cache.backend.CircularReferenceError.path", "signature": null, "docstring": null } } }, "CacheBackend": { "name": "CacheBackend", "kind": "class", "path": "mongo_ops.cache.backend.CacheBackend", "signature": null, "docstring": "Abstract interface for cache backends.\n\nImplementations store byte-encoded values keyed by string, track usage\nstatistics, and manage their own lifecycle. The in-memory and Redis\nbackends both implement this contract.", "members": { "get": { "name": "get", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.get", "signature": "get(key: str) -> bytes | None", "docstring": "Fetch a value from the cache.\n\nArgs:\n key (str):\n The cache key.\n\nReturns:\n Optional[bytes]: The cached bytes, or None on a miss." }, "set": { "name": "set", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.set", "signature": "set(key: str, value: bytes, ttl: int | None = None) -> None", "docstring": "Store a value in the cache.\n\nArgs:\n key (str):\n The cache key.\n value (bytes):\n The byte-encoded value to store.\n ttl (Optional[int]):\n Time-to-live in seconds. When None, the backend default\n applies." }, "delete": { "name": "delete", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.delete", "signature": "delete(key: str) -> None", "docstring": "Remove a key from the cache.\n\nArgs:\n key (str):\n The cache key." }, "exists": { "name": "exists", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.exists", "signature": "exists(key: str) -> bool", "docstring": "Check whether a key is present.\n\nArgs:\n key (str):\n The cache key.\n\nReturns:\n bool: True if the key exists, False otherwise." }, "clear_pattern": { "name": "clear_pattern", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.clear_pattern", "signature": "clear_pattern(pattern: str) -> None", "docstring": "Remove all keys matching a glob pattern.\n\nArgs:\n pattern (str):\n Glob-style pattern; a trailing `*` matches prefixes." }, "get_stats": { "name": "get_stats", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.get_stats", "signature": "get_stats() -> CacheStats", "docstring": "Return a snapshot of cache statistics.\n\nReturns:\n CacheStats: A copy of the current stats counters." }, "initialize": { "name": "initialize", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.initialize", "signature": "initialize() -> None", "docstring": "Start background resources owned by the backend.\n\nShould be called once during application startup, after the\nrepositories are connected." }, "shutdown": { "name": "shutdown", "kind": "function", "path": "mongo_ops.cache.backend.CacheBackend.shutdown", "signature": "shutdown() -> None", "docstring": "Stop and release background resources.\n\nShould be called once during application shutdown." } } } } } }