MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / checkLimit

Method checkLimit

src/Content/ContentDbDict.py:45–48  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

43
44 # Only keep last 10 accessed json in memory
45 def checkLimit(self):
46 if len(self.cached_keys) > 10:
47 key_deleted = self.cached_keys.pop(0)
48 dict.__setitem__(self, key_deleted, False)
49
50 def addCachedKey(self, key):
51 if key not in self.cached_keys and key != "content.json" and len(key) > 40: # Always keep keys smaller than 40 char

Callers 2

loadItemMethod · 0.95
__setitem__Method · 0.95

Calls 1

__setitem__Method · 0.45

Tested by

no test coverage detected