Skip to content

Commit 40ac88c

Browse files
committed
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
1 parent 6b25d37 commit 40ac88c

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

docs/build/unreleased/202.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. change::
2+
:tags: bug, regression
3+
:tickets: 202
4+
5+
Fixed regression where :class:`.ProxyBackend` was missing several methods
6+
that were added as part of the 1.1 release.

dogpile/cache/proxy.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from .api import CacheBackend
2020
from .api import CacheMutex
2121
from .api import KeyType
22+
from .api import SerializedReturnType
2223

2324

2425
class ProxyBackend(CacheBackend):
@@ -101,3 +102,17 @@ def delete_multi(self, keys: Sequence[KeyType]) -> None:
101102

102103
def get_mutex(self, key: KeyType) -> Optional[CacheMutex]:
103104
return self.proxied.get_mutex(key)
105+
106+
def get_serialized(self, key: KeyType) -> SerializedReturnType:
107+
return self.proxied.get_serialized(key)
108+
109+
def get_serialized_multi(
110+
self, keys: Sequence[KeyType]
111+
) -> Sequence[SerializedReturnType]:
112+
return self.proxied.get_serialized_multi(keys)
113+
114+
def set_serialized(self, key: KeyType, value: bytes) -> None:
115+
self.proxied.set_serialized(key, value)
116+
117+
def set_serialized_multi(self, mapping: Mapping[KeyType, bytes]) -> None:
118+
self.proxied.set_serialized_multi(mapping)

tests/cache/test_dbm_backend.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33

44
from dogpile.cache.backends.file import AbstractFileLock
5+
from dogpile.cache.proxy import ProxyBackend
56
from dogpile.util.readwrite_lock import ReadWriteMutex
67
from . import assert_raises_message
78
from ._fixtures import _GenericBackendTest
@@ -53,6 +54,15 @@ class DBMBackendConditionTest(_GenericBackendTest):
5354
}
5455

5556

57+
class DBMBackendProxyTest(_GenericBackendTest):
58+
backend = "dogpile.cache.dbm"
59+
60+
config_args = {
61+
"arguments": {"filename": test_fname, "lock_factory": MutexLock},
62+
"wrap": [ProxyBackend],
63+
}
64+
65+
5666
class DBMBackendSerializerTest(
5767
_GenericSerializerTest, DBMBackendConditionTest
5868
):

0 commit comments

Comments
 (0)