def test_cull(self): from shove.cache.db import DbCache cache = DbCache(self.initstring, max_entries=1) cache['test'] = 'test' cache['test2'] = 'test' cache['test2'] = 'test' self.assertEquals(len(cache), 1)
def test_timeout(self): import time from shove.cache.db import DbCache cache = DbCache(self.initstring, timeout=1) cache['test'] = 'test' time.sleep(2) def tmp(): cache['test'] self.assertRaises(KeyError, tmp)
def setUp(self): from shove.cache.db import DbCache self.cache = DbCache(self.initstring)