示例#1
0
 def testSetValuesWithPrefix(self):
     """L{BaseCache.setValues} uses the given prefix as key."""
     cache = BaseCache()
     cache.keyPrefix = 'prefix:'
     cache.setValues({'identifier1': 'test1', 'identifier2': 'test2'})
     self.assertEqual('test1', self.cache.get('prefix:identifier1'))
     self.assertEqual('test2', self.cache.get('prefix:identifier2'))
示例#2
0
 def testGetValuesWithPrefix(self):
     """L{BaseCache.getValues} uses the given prefix as key."""
     self.cache.set('prefix:identifier1', 'test1')
     self.cache.set('prefix:identifier2', 'test2')
     cache = BaseCache()
     cache.keyPrefix = 'prefix:'
     result = cache.getValues([u'identifier1', u'identifier2'])
     self.assertEqual([u'test1', u'test2'], result)
示例#3
0
 def testGetValuesWithPrefix(self):
     """L{BaseCache.getValues} uses the given prefix as key."""
     self.cache.set('prefix:identifier1', 'test1')
     self.cache.set('prefix:identifier2', 'test2')
     cache = BaseCache()
     cache.keyPrefix = 'prefix:'
     result = cache.getValues([u'identifier1', u'identifier2'])
     self.assertEqual([u'test1', u'test2'], result)
示例#4
0
 def testDeleteValuesWithPrefix(self):
     """L{BaseCache.deleteValues} uses the given prefix as key."""
     self.cache.set('prefix:identifier1', 'test1')
     self.cache.set('prefix:identifier2', 'test2')
     cache = BaseCache()
     cache.keyPrefix = 'prefix:'
     cache.deleteValues([u'identifier1', u'identifier2'])
     self.assertEqual([None, None],
                      self.cache.mget(
                          [u'prefix:identifier1', u'prefix:identifier2']))
示例#5
0
 def testDeleteValuesWithPrefix(self):
     """L{BaseCache.deleteValues} uses the given prefix as key."""
     self.cache.set('prefix:identifier1', 'test1')
     self.cache.set('prefix:identifier2', 'test2')
     cache = BaseCache()
     cache.keyPrefix = 'prefix:'
     cache.deleteValues([u'identifier1', u'identifier2'])
     self.assertEqual([None, None],
                      self.cache.mget([u'prefix:identifier1',
                                       u'prefix:identifier2']))