Beispiel #1
0
 def test_cache_miss(self):
     cache = ExpiringCache(expire_in_seconds = 10)
     assert_that(cache.get('nonexisting'), equal_to(None))
Beispiel #2
0
 def test_cache_get_set(self):
     cache = ExpiringCache(expire_in_seconds = 3600)
     cache.set("key", "value")
     assert_that(cache.get("key"), equal_to("value"))
Beispiel #3
0
 def test_cache_expired(self):
     cache = ExpiringCache(expire_in_seconds = -10) # expires straight away
     cache.set("key", "value")
     assert_that(cache.get('key'), equal_to(None))