Skip to content

Commit

Permalink
Merge pull request #4 from amirreza8002/lock
Browse files Browse the repository at this point in the history
added blocking and lock_class to get_lock
  • Loading branch information
amirreza8002 authored Oct 7, 2024
2 parents 08796d0 + 8e41cf4 commit c902fec
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 0.1.6
-------------

- added ``blocking`` and ``lock_class`` to get_lock parameters.

Version 0.1.5
-------------

Expand Down
2 changes: 1 addition & 1 deletion django_valkey/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = (0, 1, 5)
VERSION = (0, 1, 6)
__version__ = ".".join(map(str, VERSION))


Expand Down
4 changes: 4 additions & 0 deletions django_valkey/async_cache/client/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,10 @@ async def get_lock(
version: int | None = None,
timeout: float | int | None = None,
sleep: float = 0.1,
blocking: bool = True,
blocking_timeout: float | None = None,
client: AValkey | Any | None = None,
lock_class=None,
thread_local: bool = True,
) -> "Lock":
"""Returns a Lock object, the object then should be used in an async context manager"""
Expand All @@ -308,7 +310,9 @@ async def get_lock(
key,
timeout=timeout,
sleep=sleep,
blocking=blocking,
blocking_timeout=blocking_timeout,
lock_class=lock_class,
thread_local=thread_local,
)

Expand Down
4 changes: 4 additions & 0 deletions django_valkey/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,10 @@ def get_lock(
version: int | None = None,
timeout: float | None = None,
sleep: float = 0.1,
blocking: bool = True,
blocking_timeout: float | None = None,
client: Backend | Any | None = None,
lock_class=None,
thread_local: bool = True,
) -> "Lock":
client = self._get_client(write=True, client=client)
Expand All @@ -434,7 +436,9 @@ def get_lock(
key,
timeout=timeout,
sleep=sleep,
blocking=blocking,
blocking_timeout=blocking_timeout,
lock_class=lock_class,
thread_local=thread_local,
)

Expand Down
4 changes: 4 additions & 0 deletions django_valkey/client/sharded.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ def get_lock(
version=None,
timeout=None,
sleep=0.1,
blocking: bool = True,
blocking_timeout=None,
client=None,
lock_class=None,
thread_local=True,
):
if client is None:
Expand All @@ -295,8 +297,10 @@ def get_lock(
key,
timeout=timeout,
sleep=sleep,
blocking=blocking,
client=client,
blocking_timeout=blocking_timeout,
lock_class=lock_class,
thread_local=thread_local,
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-valkey"
version = "0.1.5"
version = "0.1.6"
license = "BSD-3-Caluse"
description = "a valkey cache and session backend for django"
authors = ["amirreza <[email protected]>"]
Expand Down

0 comments on commit c902fec

Please sign in to comment.