diff --git a/test/test_cache.py b/test/test_cache.py index b65e117..f483c76 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -42,6 +42,18 @@ def test_get_cache(): assert c.u1 == [100] +def test_get_cache_no_expire(): + # force a value in cache, try if reget corrupted value + od1 = make_description() + c = Config(od1) + values = c.cfgimpl_get_values() + settings = c.cfgimpl_get_settings() + settings._p_.setcache('u1', set(['inject2']), None) + assert 'inject2' in settings[od1.u1] + values._p_.setcache('u1', 200, None) + assert c.u1 == [200] + + def test_cache_reset(): od1 = make_description() c = Config(od1) diff --git a/tiramisu/storage/cache.py b/tiramisu/storage/cache.py index 98db066..347d270 100644 --- a/tiramisu/storage/cache.py +++ b/tiramisu/storage/cache.py @@ -32,7 +32,7 @@ class Cache(object): def getcache(self, path, exp): value, created = self._cache[path] - if exp <= created: + if created is None or exp <= created: return True, value return False, None