Пример #1
0
    def test_set(self):
        simple_cache = SimpleCache()
        simple_cache.set('foo', 'bar')
        simple_cache.set('moof', 'baz', timeout=1)

        # Use the underlying cache system to verify.
        self.assertEqual(cache.get('foo'), 'bar')
        self.assertEqual(cache.get('moof'), 'baz')

        # Check expiration.
        time.sleep(2)
        self.assertEqual(cache.get('moof'), None)
Пример #2
0
 def test_set(self):
     simple_cache = SimpleCache()
     simple_cache.set('foo', 'bar')
     simple_cache.set('moof', 'baz', timeout=1)
     
     # Use the underlying cache system to verify.
     self.assertEqual(cache.get('foo'), 'bar')
     self.assertEqual(cache.get('moof'), 'baz')
     
     # Check expiration.
     time.sleep(2)
     self.assertEqual(cache.get('moof'), None)