def __setitem__(self, key, value):
        now = self._clock.time_msec()
        self._cache[key] = _CacheEntry(now, value)

        # Evict if there are now too many items
        if self._max_len and self._max_len > len(self._cache.keys()):
            sorted_entries = sorted(
                self._cache.items(),
                key=lambda item: item[1].time,
            )

            for k, _ in sorted_entries[self._max_len:]:
                self._cache.pop(k)
dataset/ETHPy150Open matrix-org/synapse/synapse/util/caches/expiringcache.py/ExpiringCache.__setitem__/swapped operands of `>`