def test_cull_max_entries_minus_one(self): # cull with MAX_ENTRIES = -1 should never clear anything that is not # expired # one expired key cache.set("key", "value", 0.1) time.sleep(0.2) # 90 non-expired keys for n in range(9): cache.set_many({str(n * 10 + i): True for i in range(10)}) cache.cull() assert self.table_count() == 90
def test_cull_max_entries_minus_one(self): # cull with MAX_ENTRIES = -1 should never clear anything that is not # expired # one expired key cache.set('key', 'value', 0.1) time.sleep(0.2) # 90 non-expired keys for n in six.moves.range(9): cache.set_many({ str(n * 10 + i): True for i in six.moves.range(10) }) cache.cull() assert self.table_count() == 90
def test_cull(self): cache.cull()
def handle(self, *args, **options): while True: deleted = cache.cull() if deleted <= 0: break