Commit a52dcb66 authored by Ales Zoulek's avatar Ales Zoulek

No need for expiration function

parent d6b357de
......@@ -128,17 +128,6 @@ class CacheClass(BaseCache):
# result is a boolean
return result
def expire(self, key, timeout=None, version=None):
"""
Set content expiration, if necessary
"""
key = self.make_key(key, version=version)
if not timeout:
timeout = self.default_timeout
# If the expiration command returns false, we need to reset the key
# with the new expiration
self._cache.expire(key, timeout)
def delete(self, key, version=None):
"""
Remove a key from the cache.
......
......@@ -195,27 +195,6 @@ class RedisCacheTests(TestCase):
self.cache.set(key, value);
self.assertTrue(self.cache._cache.ttl(key) > 0)
def test_set_expiration_first_expire_call(self):
key, value = self.cache.make_key('key'), 'value'
# bypass public set api so we don't set the expiration
self.cache._cache.set(key, pickle.dumps(value))
self.cache.expire('key', 1)
time.sleep(2)
self.assertEqual(self.cache.get('key'), None)
def test_set_expiration_mulitple_expire_calls(self):
key, value = 'key', 'value'
self.cache.set(key, value, 1)
time.sleep(2)
self.assertEqual(self.cache.get('key'), None)
self.cache.set(key, value, 100)
self.assertEqual(self.cache.get('key'), value)
time.sleep(2)
self.assertEqual(self.cache.get('key'), value)
self.cache.expire(key, 1)
time.sleep(2)
self.assertEqual(self.cache.get('key'), None)
def test_unicode(self):
# Unicode values can be cached
stuff = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment