diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-08-24 14:22:43 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-08-24 14:22:43 -0400 |
commit | 4eacc3655b53e52752f5393ac5808ab2cc3507f9 (patch) | |
tree | a54a966dcfe50c503d8064b9a7a5d1c830aa2b2c /README.rst | |
parent | a1f5814040b0df131f68a264f1a19c69533f763a (diff) | |
download | dogpile-core-4eacc3655b53e52752f5393ac5808ab2cc3507f9.tar.gz |
fix readme
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -7,6 +7,8 @@ Beaker package, for simple and generic usage. Usage:: + from dogpile import Dogpile + # store a reference to a "resource", some # object that is expensive to create. the_resource = [None] @@ -30,16 +32,16 @@ Usage:: use_the_resource() Above, ``some_creation_function()`` will be called -when :meth:`.Dogpile.acquire` is first called. The +when ``Dogpile.acquire()`` is first called. The block then proceeds. Concurrent threads which -call :meth:`.Dogpile.acquire` during this initial period +call ``Dogpile.acquire()`` during this initial period will block until ``some_creation_function()`` completes. Once the creation function has completed successfully, -new calls to :meth:`.Dogpile.acquire` will route a single +new calls to ``Dogpile.acquire()`` will route a single thread into new calls of ``some_creation_function()`` each time the expiration time is reached. Concurrent threads -which call :meth:`.Dogpile.acquire` during this period will +which call ``Dogpile.acquire()`` during this period will fall through, and not be blocked. It is expected that the "stale" version of the resource remain available at this time while the new one is generated. @@ -51,12 +53,12 @@ The example of this is when the creation function has prepared a new datafile to replace the old one, and would like to switch in the "new" file only when other threads have finished using it. -To enable this feature, use :class:`.SyncReaderDogpile`. -Then use :meth:`.SyncReaderDogpile.acquire_write_lock` for the critical section +To enable this feature, use `SyncReaderDogpile``. +Then use ``SyncReaderDogpile.acquire_write_lock()`` for the critical section where readers should be blocked:: - + from dogpile import SyncReaderDogpile - + dogpile = SyncReaderDogpile(3600) def some_creation_function(): |