support no expire in getcache
This commit is contained in:
parent
632de1cffb
commit
3dc72c505c
|
@ -42,6 +42,18 @@ def test_get_cache():
|
||||||
assert c.u1 == [100]
|
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():
|
def test_cache_reset():
|
||||||
od1 = make_description()
|
od1 = make_description()
|
||||||
c = Config(od1)
|
c = Config(od1)
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Cache(object):
|
||||||
|
|
||||||
def getcache(self, path, exp):
|
def getcache(self, path, exp):
|
||||||
value, created = self._cache[path]
|
value, created = self._cache[path]
|
||||||
if exp <= created:
|
if created is None or exp <= created:
|
||||||
return True, value
|
return True, value
|
||||||
return False, None
|
return False, None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue