Source

wheezy.caching / src / wheezy / caching / patterns.py

Diff from to

src/wheezy/caching/patterns.py

 from time import sleep
 from time import time
 
+from wheezy.caching.dependency import CacheDependency
+
 
 class Cached(object):
     """ Specializes access to cache by using a number of common settings
         """
         return self.cache.decr(key, delta, self.namespace, initial_value)
 
+    def dependency(self, master_key):
+        """ Returns an instance of `CacheDependency` initialized by
+            given *master_key*.
+        """
+        return CacheDependency(self.cache, master_key, self.time,
+                               self.namespace)
+
     def get_or_add(self, key, create_factory, dependency_factory):
         """ Cache Pattern: get an item by *key* from *cache* and
             if it is not available use *create_factory* to aquire one.