MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / get_stats

Method get_stats

core/cache.py:256–278  ·  view source on GitHub ↗

Get cache statistics. Returns: Dictionary with cache stats

(self)

Source from the content-addressed store, hash-verified

254 logger.info(f"Removed {removed} expired cache entries")
255
256 return removed
257
258 def get_stats(self) -> dict:
259 """Get cache statistics.
260
261 Returns:
262 Dictionary with cache stats
263 """
264 memory_entries = len(self._memory_cache)
265
266 disk_entries = 0
267 try:
268 disk_entries = len(list(self.cache_dir.glob("*.json")))
269 except Exception as e:
270 logger.error(f"Error counting disk cache: {e}")
271
272 total_entries = max(memory_entries, disk_entries)
273
274 return {
275 "memory_entries": memory_entries,
276 "disk_entries": disk_entries,
277 "total_entries": total_entries,
278 "cache_directory": str(self.cache_dir),
279 "ttl_seconds": self.ttl,
280 }
281

Callers 2

test_cache_clear_allMethod · 0.45
test_cache_statsMethod · 0.45

Calls

no outgoing calls

Tested by 2

test_cache_clear_allMethod · 0.36
test_cache_statsMethod · 0.36