diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-05-20 10:25:03 -0400 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2021-05-20 17:27:43 +0000 |
commit | 40ac88cc943481660e34e4257a8e3632527dd35f (patch) | |
tree | e276161e9c0a3577111e210a91d234f5c353f6aa | |
parent | 6b25d37429c5869fdb315d6550d0d9f03485b761 (diff) | |
download | dogpile-cache-40ac88cc943481660e34e4257a8e3632527dd35f.tar.gz |
Add missing methods to ProxyBackend
Fixed regression where :class:`.ProxyBackend` was missing several methods
that were added as part of the 1.1 release.
Fixes: #202
Change-Id: I7dc419ab11b47b5d39b60792e9660bfc8cbc50c6
-rw-r--r-- | docs/build/unreleased/202.rst | 6 | ||||
-rw-r--r-- | dogpile/cache/proxy.py | 15 | ||||
-rw-r--r-- | tests/cache/test_dbm_backend.py | 10 |
3 files changed, 31 insertions, 0 deletions
diff --git a/docs/build/unreleased/202.rst b/docs/build/unreleased/202.rst new file mode 100644 index 0000000..24a0be6 --- /dev/null +++ b/docs/build/unreleased/202.rst @@ -0,0 +1,6 @@ +.. change:: + :tags: bug, regression + :tickets: 202 + + Fixed regression where :class:`.ProxyBackend` was missing several methods + that were added as part of the 1.1 release. diff --git a/dogpile/cache/proxy.py b/dogpile/cache/proxy.py index 0b57edb..bf6e296 100644 --- a/dogpile/cache/proxy.py +++ b/dogpile/cache/proxy.py @@ -19,6 +19,7 @@ from .api import BackendSetType from .api import CacheBackend from .api import CacheMutex from .api import KeyType +from .api import SerializedReturnType class ProxyBackend(CacheBackend): @@ -101,3 +102,17 @@ class ProxyBackend(CacheBackend): def get_mutex(self, key: KeyType) -> Optional[CacheMutex]: return self.proxied.get_mutex(key) + + def get_serialized(self, key: KeyType) -> SerializedReturnType: + return self.proxied.get_serialized(key) + + def get_serialized_multi( + self, keys: Sequence[KeyType] + ) -> Sequence[SerializedReturnType]: + return self.proxied.get_serialized_multi(keys) + + def set_serialized(self, key: KeyType, value: bytes) -> None: + self.proxied.set_serialized(key, value) + + def set_serialized_multi(self, mapping: Mapping[KeyType, bytes]) -> None: + self.proxied.set_serialized_multi(mapping) diff --git a/tests/cache/test_dbm_backend.py b/tests/cache/test_dbm_backend.py index 84bace1..5d53f0d 100644 --- a/tests/cache/test_dbm_backend.py +++ b/tests/cache/test_dbm_backend.py @@ -2,6 +2,7 @@ import os import sys from dogpile.cache.backends.file import AbstractFileLock +from dogpile.cache.proxy import ProxyBackend from dogpile.util.readwrite_lock import ReadWriteMutex from . import assert_raises_message from ._fixtures import _GenericBackendTest @@ -53,6 +54,15 @@ class DBMBackendConditionTest(_GenericBackendTest): } +class DBMBackendProxyTest(_GenericBackendTest): + backend = "dogpile.cache.dbm" + + config_args = { + "arguments": {"filename": test_fname, "lock_factory": MutexLock}, + "wrap": [ProxyBackend], + } + + class DBMBackendSerializerTest( _GenericSerializerTest, DBMBackendConditionTest ): |