MCPcopy Create free account
hub / github.com/authlib/authlib / _prune

Method _prune

tests/flask/cache.py:18–26  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

16 self._threshold = threshold
17
18 def _prune(self):
19 if len(self._cache) > self._threshold:
20 now = time.time()
21 toremove = []
22 for idx, (key, (expires, _)) in enumerate(self._cache.items()):
23 if (expires != 0 and expires <= now) or idx % 3 == 0:
24 toremove.append(key)
25 for key in toremove:
26 self._cache.pop(key, None)
27
28 def _normalize_timeout(self, timeout):
29 if timeout is None:

Callers 1

setMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected