Mikhail Korobov  committed f157423

Fixed a bug: attempt to invalidate uncalled function no longer raise exception

  • Participants
  • Parent commits 96fa235
  • Branches default

Comments (0)

Files changed (3)

File cache_utils/

         def invalidate(*args, **kwargs):
             ''' invalidates cache result for function called with passed arguments '''
+            if not hasattr(wrapper, '_full_name'):
+                return
             key = _cache_key(wrapper._full_name, 'function', args, kwargs)
             cache.delete(key, **backend_kwargs)

File cache_utils/

         self.assertEqual(, 2)
+    def test_invalidate_nonexisting(self):
+        @cached(60)
+        def foo(x):
+            return 1
+        foo.invalidate(5) # this shouldn't raise exception
 class DecoratorTest(ClearMemcachedTest):
 #!/usr/bin/env python
 from distutils.core import setup