def test_memory_cache_capacity(self): c = MemoryCache(capacity=2) c.set('foo', 'bar') assert c.get('foo') == 'bar' # Since we have capacity=2, adding two more keys will # remove the first one. c.set('key2', 'value2') c.set('key3', 'value3') assert c.get('foo') is None
def test_memory_cache_capacity(self): c = MemoryCache(capacity=2) c.set('foo', 'bar') assert c.get('foo') == 'bar' # Since we have capacity=2, adding two more keys will # remove the first one. c.set('key2', 'value2') c.set('key3', 'value3') assert c.get('foo') is None
def get(self, key): self.getc += 1 return MemoryCache.get(self, key)
def get(self, key): self.getc += 1 return MemoryCache.get(self, key)