| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added new construct :class:`.api.CantDeserializeException` which can be
raised by user-defined deserializer functions which would be passed to
:paramref:`.CacheRegion.deserializer`, to indicate a cache value that can't
be deserialized and therefore should be regenerated. This can allow an
application that's been updated to gracefully re-cache old items that were
persisted from a previous version of the application. Pull request courtesy
Simon Hewitt.
Closes: #236
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/236
Pull-request-sha: f2ec26521acb8069d092c51749952f8540b5d75c
Change-Id: Idec175b9c06274628d3d027024f9878abb1d188b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Moved the :paramref:`.MemcacheArgs.dead_retry` argument and the
:paramref:`.MemcacheArgs.socket_timeout` argument which were
erroneously added to the "set_parameters",
where they have no effect, to be part of the Memcached connection
arguments :paramref:`.MemcachedBackend.dead_retry`,
:paramref:`.MemcachedBackend.socket_timeout`.
Indeed, In my previous patch [1] I proposed to add the ``dead_retry`` and ``socket_timeout`` params to the ``MemcacheArgs`` class. I was wrong. My goal was to pass these parameters to the client during its initialization to set the memcached client dead_retry and socket_timeout arguments [2].
By using the MemcacheArgs they are passed to the method calls which is not what it was requested in the feature request [3]. I misunderstood the goal of this class (MemcacheArgs).
The ``MemcacheArgs`` class is only inherited by the ``MemcachedBackend`` class and the ``PylibmcBackend`` class. Both libraries doesn't support ``dead_retry`` and ``socket_timeout`` in their methods related to the memcache API commands (set, get, set_multi, etc), so for this reason I think we can move those parameters safely.
My previous patch led to issues [4][5] that I'm able to reproduce locally by using oslo.cache's functional test. These changes fix these issues.
[1] https://github.com/sqlalchemy/dogpile.cache/commit/1de93aab14c1274f20c1f44f8adff3b143c864f6
[2] https://github.com/linsomniac/python-memcached/blob/7942465eba2009927e5d14b4b6dbd48b75780d80/memcache.py#L165
[3] https://github.com/sqlalchemy/dogpile.cache/issues/223
[4] https://bugzilla.redhat.com/show_bug.cgi?id=2103117
[5] https://review.opendev.org/c/openstack/requirements/+/848827
Closes: #228
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/228
Pull-request-sha: dcef04b200c62d615054b3520ece480825597e61
Change-Id: Ic77c1d657b81449a34114cf9f61c350ffc7e2ba1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added :paramref:`.MemcacheArgs.dead_retry` and
:paramref:`.MemcacheArgs.socket_timeout` to the dictionary of
additional keyword arguments that will be passed
directly to ``GenericMemcachedBackend()``.
Thanks to François Rigault for assistance.
Closes: #223
Co-Authored-By: François Rigault <frigo@amadeus.com>
Closes: #224
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/224
Pull-request-sha: 5210f8eae297d1dd192aa178434beb9e1eb98387
Change-Id: I058a52e1c3561508763d036e7827b464b2b734d7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added :paramref:`.RedisBackend.connection_kwargs` parameter, which is a
dictionary of additional keyword arguments that will be passed directly to
``StrictRedis()`` or ``StrictRedis.from_url()``, in the same way that this
parameter works with the :class:`.RedisSentinelBackend` already.
Thanks to Pim Beenes for assistance.
Closes: #221
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/221
Pull-request-sha: 26c6cc97ad677d9df4e7387bbae861c15db395de
Change-Id: I0991a25ddf31a64d831d3b7e56b3cb9a41685260
|
|
|
|
|
|
|
|
| |
using the scripts from
https://github.com/scoriacorp/docker-tls-memcached so that
we can refresh the certs locally
Change-Id: I795e00c2191a1f771528518892112b74a0b8ea56
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These changes allow us to configure pymemcache's HashClient retrying
mechanisms by exposing his public params. Without these changes that we are
limitated to the default values.
Configuring the internal retrying feature of the HashClient can be
useful in a HA context to properly setup the failover.
The internal retrying feature are a good complement to the retrying
wrapper introduced previously.
[1] https://github.com/pinterest/pymemcache/blob/071191455363943e7d5919701465455e78bb64ae/pymemcache/client/hash.py#L66-L71
Change-Id: Id7aa3d363d281daa640ca34a325454d4c18a8ff0
|
|
|
|
|
|
| |
this was failing on a generic tox run due to dependencies
Change-Id: I25806a256e6e5f876a1c896e6a76bec976612cef
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Socket keepalive capabilities have been introduced [1][2][3] with pymemcache
3.5.0 [4][5]. These changes allow to pass keepalive configuration to the
pymemcache client.
Retry mechanisms have been implemented [6][7] with pymemcache 3.5.0 [5][8].
These changes allow to instantiate a ``RetryingClient`` by using
dogpile.cache.
[1] https://github.com/pinterest/pymemcache/commit/b289c87bb89b3ab477bd5d92c8951ab42c923923
[2] https://github.com/pinterest/pymemcache/commit/c782de1cac7cfaf4f6868d17682197022dad2d6b
[3] https://github.com/pinterest/pymemcache/commit/4d46f5ad8ddbd860e5219965df0714bdc15062f6
[4] https://github.com/pinterest/pymemcache/commit/07b5ecc21ce5d388d4312c943d79f813311e349f
[5] https://pypi.org/project/pymemcache/3.5.0/
[6] https://github.com/pinterest/pymemcache/commit/75fe5c81c35d2bcfc8e6a697aef948efbfebe8ba
[7] https://pymemcache.readthedocs.io/en/latest/getting_started.html#using-the-built-in-retrying-mechanism
[8] https://github.com/pinterest/pymemcache/commit/07b5ecc21ce5d388d4312c943d79f813311e349f
Closes: #205
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/205
Pull-request-sha: 8a7ea5dfb0653b675f2ce9eb4873d8bf08841028
Change-Id: Ia2e76475943bc8ec86b5974217d1c92110be5b43
|
|
|
|
|
|
|
| |
also pin versions for zimports / flake8,
fix some things for mypy
Change-Id: Ia619e5ae9ffcf95b4546e2b320e5186402c15467
|
|
|
|
|
|
|
|
| |
Fixed regression where :class:`.ProxyBackend` was missing several methods
that were added as part of the 1.1 release.
Fixes: #202
Change-Id: I7dc419ab11b47b5d39b60792e9660bfc8cbc50c6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added support for the pymemcache backend, using the
``"dogpile.cache.pymemcache"`` backend identifier. Pull request courtesy
Moisés Guimarães de Medeiros.
Also includes some refinements to two of the most commonly failing
"timing intensive" tests so that they are more reliable.
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #134
Closes: #197
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/197
Pull-request-sha: 29ec25a62218932e07a33829dc74b148f16d4795
Change-Id: Id73faeb9a7262683921ea14555a29288c3183efd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added new region method :meth:`.Region.key_is_locked`. Returns True if the
given key is subject to the dogpile lock, which would indicate that the
generator function is running at that time. Pull request courtesy Bastien
Gerard.
Fixes: #101
Closes: #198
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/198
Pull-request-sha: 8a5ec7aa07dbdfc654617632ffffae6834078263
Change-Id: I8449beeeef0052ac11a4e3d2e8305e10ba70a765
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I0c2fbb5e577c956c3d3f80abeb910ec6f546cb23
|
|/
|
|
|
|
| |
Also restore python-memcached to test suite
Change-Id: If4cd5e4604a0c5b51e1b34ba5a1a397ec1ef15cf
|
|
|
|
|
|
| |
add mypy to the test suite
Change-Id: I1eaa68e0774a0c34b4ca07f71509f9a759dbb15e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reworked the means by which values are serialized and deserialized from
backends, and provided for custom serialization of values. Added the
:paramref:`.CacheRegion.serializer` and
:paramref:`.CacheRegion.deserializer` parameters which may be set to any
serializer.
Serialization and deserialization now take place within the
:class:`.CacheRegion` so that backends may now assume string values
in all cases. This simplifies the existing backends and also makes
custom backends easier to write and maintain.
Additionally, the serializer is now applied to the user-defined value
portion of the :class:`.CachedValue` and not to the metadata or other
portions of :class:`.CachedValue` object itself, so the serialized portion
is effectively a "payload" within the larger :class:`.CachedValue`
structure that is passed as part of the larger string format. The overall
format is a separate JSON of the cached value metadata, followed by the
serialized form. This allows for end-user serialization schemes that are
hardwired to the values themselves without the need to serialize dogpile's
internal structures as well.
Pull request courtesy Alessio Bogon.
As this is a major refactor and we are Python 3, adds a significant
start to pep-484 annotations.
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Closes: #191
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/191
Pull-request-sha: 06f449c4b675ea74bf6b53539511659fb25a93f5
Change-Id: I71bce715c79b455b88aa9c17e626e929f451e1d9
|
|
|
|
|
|
|
|
|
|
|
| |
using the tox 'full' environment marker will enable
them.
Fixes: #151
Fixes: #118
Fixes: #59
Change-Id: Ida5a9572ddd7f83ef4580e9e53fe2ae8acb64496
|
|
|
|
| |
See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds the required tls_context param to enable TLS support
for bmemcached backend and its tests.
Added support for TLS connections to the bmemcached backend. Pull request
courtesy Moisés Guimarães de Medeiros.
Fixes: #173
Closes: #180
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/180
Pull-request-sha: 54b71ac349eada115e5607054c7371d8a3f272e2
Change-Id: Id62e5e9d463d6b4516a34f41f20cb2f1feac59ba
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Python 3 has a builtin unittest.mock module that is equivalent
to the external mock (in fact, the latter has become a backport
of the former), so just use it instead of introducing unnecessary
dependency.
Closes: #186
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/186
Pull-request-sha: 5beb8326183807598f568284e428928eed9b34e3
Change-Id: I86e8640b73c4b44c563efa8a80c7b005280aa020
|
|
|
|
|
|
|
|
|
|
| |
- Move setup to config declarative format
- remove everything from compat except the getargspec() utility
- remove all py2k conditionals and helpers
Change-Id: I6b64c6097cb3362b16b58eeacd27226252994522
|
|
|
|
|
|
|
|
|
|
|
| |
Added support for Redis Sentinel. Pull request courtesy Stéphane Brunner.
See :class:`.RedisSentinelBackend`.
Closes: #181
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/181
Pull-request-sha: eb34335b3f76ec0af70b50c8bf3e45b15da28ffd
Change-Id: I28adc0db467461fb0d550726f8bb83c83f70346c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added option to the Redis backend
:paramref:`.RedisBackend.thread_local_lock`, which when set to False will
disable the use of a threading local by the ``redis`` module in its
distributed lock service, which is known to interfere with the lock's
behavior when used in an "async" use case, within dogpile this would be
when using the :paramref:`.CacheRegion.async_creation_runner` feature. The
default is conservatively being left at True, but it's likely this should
be set to False in all cases, so a warning is emitted if this flag is not
set to False in conjunction with the distributed lock. Added an optional
argument to :class:`.RedisBackend` that specifies whether or not a
thread-local Redis lock should be used. This is the default, but it breaks
asynchronous runner compatibility.
Fixes: #171
Closes: #175
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/175
Pull-request-sha: 755ae1b7bd826096f9d6df3ba7ab2e20f1ac4ecd
Change-Id: Ica4ed122b86c218e92cdf6174f79ff3870067934
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added logging facililities into :class:`.CacheRegion`, to indicate key
events such as cache keys missing or regeneration of values. As these can
be very high volume log messages, ``logging.DEBUG`` is used as the log
level for the events. Pull request courtesy Stéphane Brunner.
Closes: #165
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/165
Pull-request-sha: 9e519cfbfdfb6a4a2ab10cf22b3160384a5bfe27
Change-Id: I8266ee0302f6bd6768ab1f158152d2ce2cbc6c60
|
|
|
|
|
|
|
|
| |
Fixed the :func:`.sha1_mangle_key` key mangler to coerce incoming Unicode
objects into bytes as is required by the Py3k version of this function.
Fixes: #159
Change-Id: Ia7686f8586766f586905a539e2237d2c29cb8952
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These changes format code by using:
```
$ black -l79
$ zimports
```
and some manual changes to format the code as PEP8 compliance
Closes: #146
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/146
Pull-request-sha: 6920c1cbe5351a80d157104507dea19bdf7482bf
Change-Id: I6532b61d3163695e89c97e744b6a2061cd83a97e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test cache region behaviors when `**kw` was passed to cache_on_arguments
wrapped functions (with and without).
We expect for a ValueError when **kw are passed to wrapped function.
Fixes: #144
Closes: #145
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/145
Pull-request-sha: 1e971d48070dd872ea3f61da1603f59cfb4ceb60
Change-Id: I3733ddfbaa03a00e7ceeecbad60382dc2c112de2
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed regression in 0.7.0 caused by :ticket:`136` where the assumed
arguments for the :paramref:`.CacheRegion.async_creation_runner` expanded to
include the new :paramref:`.CacheRegion.get_or_create.creator_args`
parameter, as it was not tested that the async runner would be implicitly
called with these arguments when the :meth:`.CacheRegion.cache_on_arguments`
decorator was used. The exact signature of ``async_creation_runner`` is
now restored to have the same arguments in all cases.
Fixes: #139
Change-Id: I91c95b183e01d1bbe1c42b3375fcfa65866cc97d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ``decorator`` module is now used when creating function decorators
within :meth:`.CacheRegion.cache_on_arguments` and
:meth:`.CacheRegion.cache_multi_on_arguments` so that function signatures
are preserved. Pull request courtesy ankitpatel96.
Additionally adds a small performance enhancement which is to avoid
internally creating a ``@wraps()`` decorator for the creator function on
every get operation, by allowing the arguments to the creator be passed
separately to :meth:`.CacheRegion.get_or_create`.
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #137
Change-Id: Id1008da596445770cfbf19402d38169aa60678b0
Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/136
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed all Python 3.x deprecation warnings including
``inspect.getargspec()``. Configured pytest to raise
for all warning conditions.
Fixes: #129
Copied from: Ifa73491a36e5aabbcb2b49598d8f94630917b7ae
Change-Id: I530dc35f0c672a2bc6ea442a33cd2ac9d24f2e3c
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixed issue in the :meth:`.CacheRegion.get_or_create_multi` method which
was erroneously considering the cached value as the timestamp field if the
:meth:`.CacheRegion.invalidate` method had ben used, usually causing a
``TypeError`` to occur, or in less frequent cases an invalid result for
whether or not the cached value was invalid, leading to excessive caching
or regeneration. The issue was a regression caused by an implementation
issue in the pluggable invalidation feature added in :ticket:`38`.
Change-Id: Ibc08ec153a4c05d070661278b64695000cff4cef
Fixes: #128
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Added method :meth:`.CacheRegion.actual_backend` which calculates and
caches the actual backend for the region, which may be abstracted by
the use of one or more :class:`ProxyBackend` subclasses.
Change-Id: I91cb858b233bae642c47178e2e7a780b2fef801c
Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/65
Fixes: #123
|
|/
|
|
|
|
|
|
|
| |
Fixed a condition in the :class:`.Lock` where the "get" function could be
called a second time unnecessarily, when returning an existing, expired
value from the cache.
Change-Id: I7b4f529a191130f99bc15763a446d1d441c50cbe
Fixes: #122
|
|
|
|
|
|
| |
is set. fixes #116
Change-Id: Ic8f781d31ac35372f4fec06b9f98f65a750e6c2e
|
|
|
|
|
|
|
|
|
|
| |
A new exception class :class:`.exception.PluginNotFound` is now
raised when a particular cache plugin class cannot be located
either as a setuptools entrypoint or as a registered backend.
Previously, a plain ``Exception`` was thrown. Pull request
courtesy Jamie Lennox.
Change-Id: Iceab2d613d2d802618dc0bed8ec2db694176c788
|
|
|
|
|
|
|
|
|
|
| |
The :attr:`.api.NO_VALUE` constant now has a fixed ``__repr__()``
output, so that scenarios where this constant's string value
ends up being used as a cache key do not create multiple values.
Pull request courtesy Paul Brown.
Change-Id: Iecc9633d6be562bc6821bf4ee2ff3f29d1b31e80
Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/61
|
|
|
|
|
|
|
|
|
|
|
|
| |
should_cache_fn
If `Region.get_or_create_multi` is used with a `should_cache`
function and no value of the current set should be cached,
do not try to store the empty dict in the backend. It's
unnecessary and also breaks on some backends such as Redis.
Change-Id: Ib7a48d0d7b2f6569e09008f4603f8a355bf9396a
Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/58
|
|
|
|
|
|
|
|
|
| |
The only place we test "connect to backend" for memcached/redis is
in _check_backend_available. If the pifpaf environment variable
is set, assume the memcached/redis service is running, and propagate
if connect fails in this case.
Change-Id: I861b8bf028300e968e4f571a9f0aa31a2f35e8fa
|
|
|
|
|
|
|
| |
When `_user_defined_key_mangler` is not set, after calling `configure()` method on a region instance, it will be reset to `backend`'s default, which is `None`. So during the tests, the `_store_keys()` mangler function will never be called.
Change-Id: I0da923d6f3ef5f4c6b8ef468898ad2ce8d02e717
Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/54
|
|
|
|
|
|
|
|
|
| |
Introduce class RegionInvalidationStrategy that performs region
invalidation. Add region_invalidator parameter
to CacheRegion.configure to pass custom invalidator object.
Fixes: #38
Change-Id: I62f5394e3916ed8debf9e23fcd18df4c4793f69c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add in a key-word-arg cache key generator that may be optionally
used. This generator will generate a key that mirrors closely to
the original key generator. The key difference is that it will
flatten all arguments down to just the values ordered alphabetically
based on the argument name. This order will be used to ensure that
regardless of the order that the keys are passed (positional,
key-word, or out-of-order key-word) the cache key ends up being
the same.
This was not made the default keygenerator to avoid reverse
incompatibilities with developers that are relying on stable
cache-key generation (e.g. storing data via the memcache-like
interface to a non-volitile backend).
Fixes: #43
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: I86c9d5e9c611090d5a84d8a746486a0b6c80039a
Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/46
|
|
|
|
| |
Change-Id: Iaf10a097b90ace7c96962ead8202beb346002e72
|
|
|
|
|
|
|
| |
Try to improve test stability here using a weakref.ref counting
approach
Change-Id: I02ed38c2c4d070c1e5d3ce8336500cf977e06434
|
|
|
|
|
| |
- correct test fixtures to illustrate import failure
of backend vs. not having actual drivers installed
|
|
|
|
|
|
| |
as the other memcached libs
Change-Id: I551bd6b7b16766892addc71695ee4a7e15098d24
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The dogpile.core package itself is EOLed. The features
within it are now moved underneath the "dogpile"
and "dogpile.util" namespaces, and the namespace packaging
directives are removed. dogpile.cache has no
dependencies on "dogpile.core" as a namespace any longer,
though it does provide dogpile/core.py for backwards
compatibility.
fixes #91
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: Ia1ca428616073755aec74c2ac4780cd634092ca8
Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/48
|
|
|
|
| |
Change-Id: I16a5e9ca797d47d3ce05dc4eb57bc70aa6f28699
|
|
|
|
|
|
|
|
|
| |
The Redis backend now creates a copy of the "arguments" dictionary passed
to it, before popping values out of it. This prevents the given
dictionary from losing its keys.
Change-Id: I17c5891cea82c2edaa09290ff974a261f909a811
(cherry picked from commit 4ca3e02f21338a3566697a84c12366b7b1950de5)
|