MCPcopy Create free account
hub / github.com/idank/explainshell / __init__

Method __init__

explainshell/caching_store.py:96–117  ·  view source on GitHub ↗
(
        self,
        db_path: str,
        *,
        max_cache_bytes: int = _MANPAGE_CACHE_MAX_BYTES,
        max_entry_bytes: int = _MANPAGE_CACHE_MAX_ENTRY_BYTES,
        max_entries: int = _MANPAGE_CACHE_MAX_ENTRIES,
    )

Source from the content-addressed store, hash-verified

94 """Read-only Store variant with a size-aware LRU for repeated lookups."""
95
96 def __init__(
97 self,
98 db_path: str,
99 *,
100 max_cache_bytes: int = _MANPAGE_CACHE_MAX_BYTES,
101 max_entry_bytes: int = _MANPAGE_CACHE_MAX_ENTRY_BYTES,
102 max_entries: int = _MANPAGE_CACHE_MAX_ENTRIES,
103 ) -> None:
104 self._db_path = db_path
105 self._local = local()
106 self._stores: list[Store] = []
107 self._stores_lock = RLock()
108 self._closed = False
109 self._lock = RLock()
110 self._manpage_cache: LRUCache[_CacheKey, _CacheValue] = LRUCache(
111 maxsize=max_cache_bytes,
112 getsizeof=_estimate_cache_value_size,
113 )
114 self._manpage_cache_hits = 0
115 self._manpage_cache_misses = 0
116 self._manpage_cache_max_entry_bytes = max_entry_bytes
117 self._manpage_cache_max_entries = max_entries
118
119 @property
120 def _conn(self) -> sqlite3.Connection:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected