Commits

Ralph Bean committed bd546e1

Expose the threaded_creation argument through to dogpile.core.

This relies on https://bitbucket.org/zzzeek/dogpile.core/pull-request/2

Comments (0)

Files changed (1)

dogpile/cache/region.py

      hash, so that the string length is fixed.  To
      disable all key mangling, set to ``False``.
 
+    :param threaded_creation: A boolean value that, when True,
+     tells dogpile.lock to create new values in a background thread
+     when possible.  The first request for a key with no value will
+     always block, but subsequent requests will cached values
+     promptly, even if the value is expired.
     """
 
     def __init__(self,
             name=None,
             function_key_generator=function_key_generator,
-            key_mangler=None
-
+            key_mangler=None,
+            threaded_creation=False,
     ):
         """Construct a new :class:`.CacheRegion`."""
         self.function_key_generator = function_key_generator
         else:
             self.key_mangler = None
         self._invalidated = None
+        self.threaded_creation = threaded_creation
 
     def configure(self, backend,
             expiration_time=None,
                 self._mutex(key),
                 gen_value,
                 get_value,
-                expiration_time) as value:
+                expiration_time,
+                self.threaded_creation) as value:
             return value
 
     def _value(self, value):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.