Skip to content

Commit

Permalink
cache's version can be Any (#14)
Browse files Browse the repository at this point in the history
matches the annotation with default_key_func

in practice, we use a hexdigest for cache versioning which is forbidden by int but works fine at runtime

Co-authored-by: Anthony Sottile <[email protected]>
  • Loading branch information
asottile-sentry and asottile committed Jul 31, 2024
1 parent 4ca4721 commit 36b0132
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions django-stubs/core/cache/backends/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,50 @@ class BaseCache:
_max_entries: int
_cull_frequency: int
key_prefix: str
version: int
version: Any
key_func: Callable
def __init__(self, params: dict[str, Any]) -> None: ...
def get_backend_timeout(self, timeout: float | None = ...) -> float | None: ...
def make_key(self, key: Any, version: int | None = ...) -> str: ...
def make_key(self, key: Any, version: Any | None = ...) -> str: ...
def validate_key(self, key: Any) -> None: ...
def make_and_validate_key(self, key: Any, version: int | None = ...) -> str: ...
def add(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = ...) -> bool: ...
async def aadd(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = ...) -> bool: ...
def get(self, key: Any, default: Any | None = ..., version: int | None = ...) -> Any: ...
async def aget(self, key: Any, default: Any | None = ..., version: int | None = ...) -> Any: ...
def set(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = ...) -> None: ...
async def aset(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = ...) -> None: ...
def touch(self, key: Any, timeout: float | None = ..., version: int | None = ...) -> bool: ...
async def atouch(self, key: Any, timeout: float | None = ..., version: int | None = ...) -> bool: ...
def delete(self, key: Any, version: int | None = ...) -> bool: ...
async def adelete(self, key: Any, version: int | None = ...) -> bool: ...
def get_many(self, keys: Iterable[Any], version: int | None = ...) -> dict[Any, Any]: ...
async def aget_many(self, keys: Iterable[Any], version: int | None = ...) -> dict[Any, Any]: ...
def make_and_validate_key(self, key: Any, version: Any | None = ...) -> str: ...
def add(self, key: Any, value: Any, timeout: float | None = ..., version: Any | None = ...) -> bool: ...
async def aadd(self, key: Any, value: Any, timeout: float | None = ..., version: Any | None = ...) -> bool: ...
def get(self, key: Any, default: Any | None = ..., version: Any | None = ...) -> Any: ...
async def aget(self, key: Any, default: Any | None = ..., version: Any | None = ...) -> Any: ...
def set(self, key: Any, value: Any, timeout: float | None = ..., version: Any | None = ...) -> None: ...
async def aset(self, key: Any, value: Any, timeout: float | None = ..., version: Any | None = ...) -> None: ...
def touch(self, key: Any, timeout: float | None = ..., version: Any | None = ...) -> bool: ...
async def atouch(self, key: Any, timeout: float | None = ..., version: Any | None = ...) -> bool: ...
def delete(self, key: Any, version: Any | None = ...) -> bool: ...
async def adelete(self, key: Any, version: Any | None = ...) -> bool: ...
def get_many(self, keys: Iterable[Any], version: Any | None = ...) -> dict[Any, Any]: ...
async def aget_many(self, keys: Iterable[Any], version: Any | None = ...) -> dict[Any, Any]: ...
def get_or_set(
self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = ...
self, key: Any, default: Any | None, timeout: float | None = ..., version: Any | None = ...
) -> Any | None: ...
async def aget_or_set(
self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = ...
self, key: Any, default: Any | None, timeout: float | None = ..., version: Any | None = ...
) -> Any | None: ...
def has_key(self, key: Any, version: int | None = ...) -> bool: ...
async def ahas_key(self, key: Any, version: int | None = ...) -> bool: ...
def incr(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ...
async def aincr(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ...
def decr(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ...
async def adecr(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ...
def has_key(self, key: Any, version: Any | None = ...) -> bool: ...
async def ahas_key(self, key: Any, version: Any | None = ...) -> bool: ...
def incr(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ...
async def aincr(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ...
def decr(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ...
async def adecr(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ...
def __contains__(self, key: Any) -> bool: ...
def set_many(self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = ...) -> list[Any]: ...
def set_many(self, data: dict[Any, Any], timeout: float | None = ..., version: Any | None = ...) -> list[Any]: ...
async def aset_many(
self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = ...
self, data: dict[Any, Any], timeout: float | None = ..., version: Any | None = ...
) -> list[Any]: ...
def delete_many(self, keys: Iterable[Any], version: int | None = ...) -> None: ...
async def adelete_many(self, keys: Iterable[Any], version: int | None = ...) -> None: ...
def delete_many(self, keys: Iterable[Any], version: Any | None = ...) -> None: ...
async def adelete_many(self, keys: Iterable[Any], version: Any | None = ...) -> None: ...
def clear(self) -> None: ...
async def aclear(self) -> None: ...
def incr_version(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ...
async def aincr_version(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ...
def decr_version(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ...
async def adecr_version(self, key: Any, delta: int = ..., version: int | None = ...) -> int: ...
def incr_version(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ...
async def aincr_version(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ...
def decr_version(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ...
async def adecr_version(self, key: Any, delta: int = ..., version: Any | None = ...) -> int: ...
def close(self, **kwargs: Any) -> None: ...
async def aclose(self, **kwargs: Any) -> None: ...

Expand Down

0 comments on commit 36b0132

Please sign in to comment.