def test_03_basic_delete(self): """Tests deleting value""" cache = Cache() self.assertTrue(cache.exists("key")) cache.delete("key") ret = cache.get("key") self.assertIsNone(ret)
def test_06_delete_base_key(self): """Tests deleting multiple key-values under one base-key""" cache = Cache() cache.delete(base_key="base1") self.assertFalse(cache.exists("key1", base_key="base1")) self.assertFalse(cache.exists("key2", base_key="base1")) self.assertFalse(cache.exists(base_key="base1")) cache.set("key1", "hi", base_key="base1") self.assertTrue(cache.exists("key1", base_key="base1")) # multi delete cache.delete(base_key=["base1", "base2"]) self.assertEqual(0, cache.exists(base_key=["base1", "base2"]))