mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:06:07 -04:00
report metrics on number of cache evictions
This commit is contained in:
parent
77c0629ebc
commit
bc496df192
5 changed files with 56 additions and 5 deletions
|
@ -79,7 +79,11 @@ class ExpiringCache(object):
|
|||
while self._max_len and len(self) > self._max_len:
|
||||
_key, value = self._cache.popitem(last=False)
|
||||
if self.iterable:
|
||||
self._size_estimate -= len(value.value)
|
||||
removed_len = len(value.value)
|
||||
self.metrics.inc_evictions(removed_len)
|
||||
self._size_estimate -= removed_len
|
||||
else:
|
||||
self.metrics.inc_evictions()
|
||||
|
||||
def __getitem__(self, key):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue