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 Sep 24, 2024
1 parent ad18a32 commit a04fb96
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 = None) -> str: ...
def make_key(self, key: Any, version: Any | None = None) -> str: ...
def validate_key(self, key: Any) -> None: ...
def make_and_validate_key(self, key: Any, version: int | None = None) -> str: ...
def add(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> bool: ...
async def aadd(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> bool: ...
def get(self, key: Any, default: Any | None = None, version: int | None = None) -> Any: ...
async def aget(self, key: Any, default: Any | None = None, version: int | None = None) -> Any: ...
def set(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> None: ...
async def aset(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> None: ...
def touch(self, key: Any, timeout: float | None = ..., version: int | None = None) -> bool: ...
async def atouch(self, key: Any, timeout: float | None = ..., version: int | None = None) -> bool: ...
def delete(self, key: Any, version: int | None = None) -> bool: ...
async def adelete(self, key: Any, version: int | None = None) -> bool: ...
def get_many(self, keys: Iterable[Any], version: int | None = None) -> dict[Any, Any]: ...
async def aget_many(self, keys: Iterable[Any], version: int | None = None) -> dict[Any, Any]: ...
def make_and_validate_key(self, key: Any, version: Any | None = None) -> str: ...
def add(self, key: Any, value: Any, timeout: float | None = ..., version: Any | None = None) -> bool: ...
async def aadd(self, key: Any, value: Any, timeout: float | None = ..., version: Any | None = None) -> bool: ...
def get(self, key: Any, default: Any | None = None, version: Any | None = None) -> Any: ...
async def aget(self, key: Any, default: Any | None = None, version: Any | None = None) -> Any: ...
def set(self, key: Any, value: Any, timeout: float | None = ..., version: Any | None = None) -> None: ...
async def aset(self, key: Any, value: Any, timeout: float | None = ..., version: Any | None = None) -> None: ...
def touch(self, key: Any, timeout: float | None = ..., version: Any | None = None) -> bool: ...
async def atouch(self, key: Any, timeout: float | None = ..., version: Any | None = None) -> bool: ...
def delete(self, key: Any, version: Any | None = None) -> bool: ...
async def adelete(self, key: Any, version: Any | None = None) -> bool: ...
def get_many(self, keys: Iterable[Any], version: Any | None = None) -> dict[Any, Any]: ...
async def aget_many(self, keys: Iterable[Any], version: Any | None = None) -> dict[Any, Any]: ...
def get_or_set(
self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = None
self, key: Any, default: Any | None, timeout: float | None = ..., version: Any | None = None
) -> Any | None: ...
async def aget_or_set(
self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = None
self, key: Any, default: Any | None, timeout: float | None = ..., version: Any | None = None
) -> Any | None: ...
def has_key(self, key: Any, version: int | None = None) -> bool: ...
async def ahas_key(self, key: Any, version: int | None = None) -> bool: ...
def incr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ...
async def aincr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ...
def decr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ...
async def adecr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ...
def has_key(self, key: Any, version: Any | None = None) -> bool: ...
async def ahas_key(self, key: Any, version: Any | None = None) -> bool: ...
def incr(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
async def aincr(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
def decr(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
async def adecr(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
def __contains__(self, key: Any) -> bool: ...
def set_many(self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = None) -> list[Any]: ...
def set_many(self, data: dict[Any, Any], timeout: float | None = ..., version: Any | None = None) -> list[Any]: ...
async def aset_many(
self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = None
self, data: dict[Any, Any], timeout: float | None = ..., version: Any | None = None
) -> list[Any]: ...
def delete_many(self, keys: Iterable[Any], version: int | None = None) -> None: ...
async def adelete_many(self, keys: Iterable[Any], version: int | None = None) -> None: ...
def delete_many(self, keys: Iterable[Any], version: Any | None = None) -> None: ...
async def adelete_many(self, keys: Iterable[Any], version: Any | None = None) -> None: ...
def clear(self) -> None: ...
async def aclear(self) -> None: ...
def incr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ...
async def aincr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ...
def decr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ...
async def adecr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ...
def incr_version(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
async def aincr_version(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
def decr_version(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
async def adecr_version(self, key: Any, delta: int = 1, version: Any | None = None) -> int: ...
def close(self, **kwargs: Any) -> None: ...
async def aclose(self, **kwargs: Any) -> None: ...

Expand Down

0 comments on commit a04fb96

Please sign in to comment.