Mike Bayer avatar Mike Bayer committed c4c1771

doc updates

Comments (0)

Files changed (3)

 \.DS_Store
 test.cfg
 .venv
+^docs/.*\.(html|inv|js)
+^docs/_static
+^docs/_sources
+^docs/.buildinfo
+.rej$

dogpile/cache/backends/file.py

                 pass
 
 class FileLock(object):
-    """Use lockfiles to coordinate read/write access to a file."""
+    """Use lockfiles to coordinate read/write access to a file.
+    
+    Only works on Unix systems, using 
+    `fcntl.flock() <http://docs.python.org/library/fcntl.html>`_.
+    
+    """
 
     def __init__(self, filename):
         self._filedescriptor = util.threading.local()

dogpile/cache/backends/redis.py

 Redis Backends
 ------------------
 
-Provides backends for talking to `redis <http://redis.io>`_.
+Provides backends for talking to `Redis <http://redis.io>`_.
 
 """
 
 import random
 import time
 
+__all__ = 'RedisBackend', 'RedisLock'
+
 class RedisBackend(CacheBackend):
-    """A `Redis <http://redis.io/>`_ backend.
+    """A `Redis <http://redis.io/>`_ backend, using the 
+    `redis-py <http://pypi.python.org/pypi/redis/>`_ backend.
 
     Example configuration::
 
                 'port': 6379,
                 'db': 0,
                 'redis_expiration_time': 60*60*2,   # 2 hours
+                'distributed_lock':True
                 }
         )
 
     :param db: integer, default is ``0``.
 
     :param redis_expiration_time: integer, number of seconds after setting
-    a value that Redis should expire it.  This should be larger than dogpile's
-    cache expiration.  By default no expiration is set.
+     a value that Redis should expire it.  This should be larger than dogpile's
+     cache expiration.  By default no expiration is set.
+
+    :param distributed_lock: boolean, when True, will use a
+     redis-lock as the dogpile lock (see :class:`.RedisLock`).
+     Use this when multiple
+     processes will be talking to the same redis instance.
+     When left at False, dogpile will coordinate on a regular
+     threading mutex.
+
     """
 
     def __init__(self, arguments):
         self.client.delete(key)
 
 class RedisLock(object):
+    """Simple distributed lock using Redis.
+
+    This is an adaptation of the memcached lock featured at
+    http://amix.dk/blog/post/19386
+
+    """
     def __init__(self, client_fn, key):
         self.client_fn = client_fn
         self.key = "_lock" + key
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.