summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-01-08 20:51:55 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-01-08 20:51:55 -0500
commit640608b8a94ea811d4f88b667c53bfd6a6b39c1c (patch)
tree83014c050d6a393f87b3c1ee18ebddeeace904e0
parent5dc5e1ab1404fbb35f33bb6a7fe7ac9505eb5fba (diff)
downloaddogpile-cache-640608b8a94ea811d4f88b667c53bfd6a6b39c1c.tar.gz
- changelog
- clean up docs
-rw-r--r--docs/build/changelog.rst10
-rw-r--r--dogpile/cache/region.py27
2 files changed, 25 insertions, 12 deletions
diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst
index 15a3e80..3a34da2 100644
--- a/docs/build/changelog.rst
+++ b/docs/build/changelog.rst
@@ -6,6 +6,16 @@ Changelog
.. change::
:tags: feature
+ :tickets: 55
+
+ Added a ``get()`` method to complement the ``set()``, ``invalidate()``
+ and ``refresh()`` methods established on functions decorated by
+ :meth:`.CacheRegion.cache_on_arguments` and
+ :meth:`.CacheRegion.cache_multi_on_arguments`. Pullreq courtesy
+ Eric Hanchrow.
+
+ .. change::
+ :tags: feature
:pullreq: 11
Added a new variant on :class:`.MemoryBackend`, :class:`.MemoryPickleBackend`.
diff --git a/dogpile/cache/region.py b/dogpile/cache/region.py
index 00228ca..88edf01 100644
--- a/dogpile/cache/region.py
+++ b/dogpile/cache/region.py
@@ -875,19 +875,14 @@ class CacheRegion(object):
.. versionadded:: 0.5.0 Added ``refresh()`` method to decorated
function.
- Lastly, a ``get()`` attribute returns either the value cached
- for the given key, or else the token ``NO_VALUE``. So for the example above,
+ Lastly, the ``get()`` method returns either the value cached
+ for the given key, or the token ``NO_VALUE`` if no such key
+ exists::
- generate_something.get(5, 6)
-
- would return ``newvalue``, whereas
-
- generate_something(99, 100)
-
- would return ``NO_VALUE``.
+ value = generate_something.get(5, 6)
.. versionadded:: 0.5.3 Added ``get()`` method to decorated
- function.
+ function.
The default key generation will use the name
of the function, the module name for the function,
@@ -1088,17 +1083,25 @@ class CacheRegion(object):
generate_something.set({"k1": "value1",
"k2": "value2", "k3": "value3"})
- an ``invalidate()`` method, which has the effect of deleting
+ ...an ``invalidate()`` method, which has the effect of deleting
the given sequence of keys using the same mechanism as that of
:meth:`.CacheRegion.delete_multi`::
generate_something.invalidate("k1", "k2", "k3")
- and finally a ``refresh()`` method, which will call the creation
+ ...a ``refresh()`` method, which will call the creation
function, cache the new values, and return them::
values = generate_something.refresh("k1", "k2", "k3")
+ ...and a ``get()`` method, which will return values
+ based on the given arguments::
+
+ values = generate_something.get("k1", "k2", "k3")
+
+ .. versionadded:: 0.5.3 Added ``get()`` method to decorated
+ function.
+
Parameters passed to :meth:`.CacheRegion.cache_multi_on_arguments`
have the same meaning as those passed to
:meth:`.CacheRegion.cache_on_arguments`.