Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions django_valkey/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ def client(self) -> Client:
self._client = self._client_cls(self._server, self._params, self)
return self._client

def make_key(self, *args, **kwargs) -> bool:
return self.client.make_key(*args, **kwargs)

def make_pattern(self, *args, **kwargs) -> bool:
return self.client.make_pattern(*args, **kwargs)


@decorate_all_methods(omit_exception)
class BackendCommands:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,3 +1208,11 @@ def test_sunionstore(self, cache: ValkeyCache):
cache.sadd("foo2", "bar2", "bar3")
assert cache.sunionstore("foo3", "foo1", "foo2") == 3
assert cache.smembers("foo3") == {"bar1", "bar2", "bar3"}

def test_make_key(self, cache: ValkeyCache):
assert cache.make_key("key", version=1, prefix="prefix") == "prefix:1:key"

def test_make_pattern(self, cache: ValkeyCache):
assert (
cache.make_pattern("key_*", version=1, prefix="prefix") == "prefix:1:key_*"
)
8 changes: 8 additions & 0 deletions tests/tests_async/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,3 +1041,11 @@ async def test_sunionstore(self, cache: AsyncValkeyCache):
await cache.asadd("foo2", "bar2", "bar3")
assert await cache.asunionstore("foo3", "foo1", "foo2") == 3
assert await cache.asmembers("foo3") == {"bar1", "bar2", "bar3"}

async def test_make_key(self, cache: AsyncValkeyCache):
assert cache.make_key("key", version=1, prefix="prefix") == "prefix:1:key"

async def test_make_pattern(self, cache: AsyncValkeyCache):
assert (
cache.make_pattern("key_*", version=1, prefix="prefix") == "prefix:1:key_*"
)
Loading