diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-10-24 12:16:55 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-10-24 12:16:55 -0400 |
commit | 16b29ab85a26e0c7d72ae99ada00632bedf28a3c (patch) | |
tree | d3075cf510e4510c0d96096d71b55b1392899ee5 /README.rst | |
parent | cac6e8f7890dcf53c6a243a0768ac749c4688524 (diff) | |
download | dogpile-core-16b29ab85a26e0c7d72ae99ada00632bedf28a3c.tar.gz |
integrate the registry with dogpile
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -192,12 +192,12 @@ Here's the memcached example again using that technique:: import pylibmc mc_pool = pylibmc.ThreadMappedPool(pylibmc.Client("localhost")) - from dogpile import Dogpile, NeedRegenerationException, NameRegistry + from dogpile import Dogpile, NeedRegenerationException import pickle import time def cache(expiration_time) - dogpile_registry = NameRegistry(lambda identifier: Dogpile(expiration_time)) + dogpile_registry = Dogpile.registry(expiration_time)) def get_or_create(key): @@ -225,7 +225,8 @@ Here's the memcached example again using that technique:: return get_or_create -Above, we use a ``NameRegistry`` which will give us a ``Dogpile`` object that's +Above, we use ``Dogpile.registry()`` to create a name-based "registry" of ``Dogpile`` +objects. This object will provide to us a ``Dogpile`` object that's unique on a certain name. When all usages of that name are complete, the ``Dogpile`` object falls out of scope, so total number of keys used is not a memory issue. Then, tell Dogpile that we'll give it the "creation time" that we'll store in our |