Skip to content

Commit

Permalink
Note that get/get_or_create expiration_time is transitory
Browse files Browse the repository at this point in the history
Also add some new seealso links, fix formatting.

Fixes: #143
Change-Id: Iedb48561ba7c9e9059b66279dd77c14223528b59
  • Loading branch information
zzzeek committed Feb 19, 2019
1 parent 39b8b6b commit 1b4ab2d
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion dogpile/cache/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,13 @@ def get(self, key, expiration_time=None, ignore_expiration=False):
which will supersede that configured on the :class:`.CacheRegion`
itself.
.. note:: The :paramref:`.CacheRegion.get.expiration_time`
argument is **not persisted in the cache** and is relevant
only to **this specific cache retrieval operation**, relative to
the creation time stored with the existing cached value.
Subsequent calls to :meth:`.CacheRegion.get` are **not** affected
by this value.
.. versionadded:: 0.3.0
:param ignore_expiration: if ``True``, the value is returned
Expand All @@ -659,6 +666,17 @@ def get(self, key, expiration_time=None, ignore_expiration=False):
.. versionadded:: 0.3.0
.. seealso::
:meth:`.CacheRegion.get_multi`
:meth:`.CacheRegion.get_or_create`
:meth:`.CacheRegion.set`
:meth:`.CacheRegion.delete`
"""

if self.key_mangler:
Expand Down Expand Up @@ -790,6 +808,13 @@ def get_or_create(
the expiration time already configured on this :class:`.CacheRegion`
if not None. To set no expiration, use the value -1.
.. note:: The :paramref:`.CacheRegion.get_or_create.expiration_time`
argument is **not persisted in the cache** and is relevant
only to **this specific cache retrieval operation**, relative to
the creation time stored with the existing cached value.
Subsequent calls to :meth:`.CacheRegion.get_or_create` are **not**
affected by this value.
:param should_cache_fn: optional callable function which will receive
the value returned by the "creator", and will then return True or
False, indicating if the value should actually be cached or not. If
Expand All @@ -811,11 +836,13 @@ def dont_cache_none(value):
.. seealso::
:meth:`.CacheRegion.get`
:meth:`.CacheRegion.cache_on_arguments` - applies
:meth:`.get_or_create` to any function using a decorator.
:meth:`.CacheRegion.get_or_create_multi` - multiple key/value
version
version
"""
orig_key = key
Expand Down

0 comments on commit 1b4ab2d

Please sign in to comment.