Example #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)
Example #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)
Example #3
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)
Example #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)
Example #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)
Example #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)
Example #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)