示例#1
0
 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
示例#2
0
 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
示例#3
0
 def get(self, key):
     self.getc += 1
     return MemoryCache.get(self, key)
示例#4
0
 def get(self, key):
     self.getc += 1
     return MemoryCache.get(self, key)