예제 #1
0
    def testDisable(self):
        caching.cache_set('disabled', value=False)
        v = caching.cache_get('disabled')
        self.assertEqual(v, False)

        caching.cache_enable(False)
        caching.cache_set('disabled', value=True)
        try:
            caching.cache_get('disabled')
            self.fail('should have raised NotCachedError')
        except caching.NotCachedError, nce:
            key = caching.cache_key('disabled')
            self.assertEqual(nce.key, key)
예제 #2
0
 def cache_key(self, *args, **kwargs):
     keys = [self.__class__.__name__, self]
     keys.extend(args)
     return caching.cache_key(keys, **kwargs)
예제 #3
0
 def testPairedDualKey(self):
     v = caching.cache_key('test', 3, more='yes')
     self.assertEqual(v, caching.CACHE_PREFIX + '::test::3::more::yes')
예제 #4
0
 def testDualKey(self):
     v = caching.cache_key('test', 2)
     self.assertEqual(v, caching.CACHE_PREFIX + '::test::2')
예제 #5
0
 def testSimpleKey(self):
     v = caching.cache_key('test')
     self.assertEqual(v, caching.CACHE_PREFIX + '::test')