Commits

Eric Hanchrow committed 5dc5e1a

Apply the new "get" attribute for :meth:`cache_multi_on_arguments` ...

... as well as :meth:`cache_on_arguments`.

  • Participants
  • Parent commits ead71f3

Comments (0)

Files changed (2)

dogpile/cache/region.py

                         in zip(gen_keys, keys))
                     )
 
+            def get(*arg):
+                keys = key_generator(*arg)
+                return self.get_multi(keys)
+
             def refresh(*arg):
                 keys = key_generator(*arg)
                 values = fn(*arg)
             decorate.set = set_
             decorate.invalidate = invalidate
             decorate.refresh = refresh
+            decorate.get = get
 
             return decorate
         return decorator

tests/cache/test_decorator.py

         eq_(go(2, 1), (2, 2, 1))
         eq_(go.get(2, 1), (2, 2, 1))
 
+    def test_explicit_get_multi(self):
+        go = self._multi_fixture(expiration_time=1)
+        eq_(go(1, 2), ['1 1', '1 2'])
+        eq_(go.get(1, 2), ['1 1', '1 2'])
+        eq_(go.get(3, 1), [NO_VALUE, '1 1'])
+        eq_(go(3, 1), ['2 3', '1 1'])
+        eq_(go.get(3, 1), ['2 3', '1 1'])
+
     def test_explicit_set_multi(self):
         go = self._multi_fixture(expiration_time=1)
         eq_(go(1, 2), ['1 1', '1 2'])