summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-10-02 13:52:56 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-10-02 13:52:56 -0400
commitb16d5bc43528cc41881f4772f0e576cca2b2dab1 (patch)
tree5c19ac4425c174e756326492db3b37304fe47593
parent9b600a18bb0eab30e2cc9dfb0c4dc1f8dfd95768 (diff)
downloaddogpile-core-b16d5bc43528cc41881f4772f0e576cca2b2dab1.tar.gz
fix example
-rw-r--r--README.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/README.rst b/README.rst
index 5335eba..62eec00 100644
--- a/README.rst
+++ b/README.rst
@@ -151,15 +151,15 @@ Memcached::
raise NeedRegenerationException()
return value
- def gen_cached():
- value = fn()
- with mc_pool.reserve() as mc:
- mc.put(key, value)
- return value
-
dogpile = Dogpile(expiration_time, init=True)
def decorate(fn):
+ def gen_cached():
+ value = fn()
+ with mc_pool.reserve() as mc:
+ mc.put(key, value)
+ return value
+
def invoke():
with dogpile.acquire(gen_cached, get_value) as value:
return value