예제 #1
0
 def test_key_incr(self, epoch_mock):
     epoch_mock.return_value = 123456
     cache_ns_key(self.namespace)  # Sets ns to 123456
     ns_key = cache_ns_key(self.namespace, increment=True)
     expected = '123457:ns:%s' % self.namespace
     eq_(ns_key, expected)
     eq_(cache_ns_key(self.namespace), expected)
예제 #2
0
 def test_key_incr(self, epoch_mock):
     epoch_mock.return_value = 123456
     cache_ns_key(self.namespace)  # Sets ns to 123456
     ns_key = cache_ns_key(self.namespace, increment=True)
     expected = '123457:ns:%s' % self.namespace
     eq_(ns_key, expected)
     eq_(cache_ns_key(self.namespace), expected)
예제 #3
0
파일: models.py 프로젝트: shahbaz17/zamboni
 def get_key(cls, key=None, invalidate=False):
     namespace = 'riscore'
     if not key:  # Assuming we're invalidating the namespace.
         cache_ns_key(namespace, invalidate)
         return
     else:
         # Using cache_ns_key so each cache val is invalidated together.
         ns_key = cache_ns_key(namespace, invalidate)
         return '%s:%s' % (ns_key, key)
예제 #4
0
 def get_key(cls, key=None, invalidate=False):
     namespace = 'riscore'
     if not key:  # Assuming we're invalidating the namespace.
         cache_ns_key(namespace, invalidate)
         return
     else:
         # Using cache_ns_key so each cache val is invalidated together.
         ns_key = cache_ns_key(namespace, invalidate)
         return '%s:%s' % (ns_key, key)
예제 #5
0
 def test_no_preexisting_key_incr(self, epoch_mock):
     epoch_mock.return_value = 123456
     eq_(cache_ns_key(self.namespace, increment=True),
         '123456:ns:%s' % self.namespace)
예제 #6
0
 def test_no_preexisting_key_incr(self, epoch_mock):
     epoch_mock.return_value = 123456
     eq_(cache_ns_key(self.namespace, increment=True),
         '123456:ns:%s' % self.namespace)
예제 #7
0
 def test_no_preexisting_key(self, epoch_mock):
     epoch_mock.return_value = 123456
     eq_(cache_ns_key(self.namespace), "123456:ns:%s" % self.namespace)