mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-09 21:46:43 +08:00
62 lines
1.6 KiB
Python
62 lines
1.6 KiB
Python
from typing import Any, Callable, Dict, Optional, Union
|
|
|
|
from django.core.cache.backends.base import BaseCache
|
|
|
|
|
|
class Options:
|
|
db_table: str = ...
|
|
app_label: str = ...
|
|
model_name: str = ...
|
|
verbose_name: str = ...
|
|
verbose_name_plural: str = ...
|
|
object_name: str = ...
|
|
abstract: bool = ...
|
|
managed: bool = ...
|
|
proxy: bool = ...
|
|
swapped: bool = ...
|
|
def __init__(self, table: str) -> None: ...
|
|
|
|
class BaseDatabaseCache(BaseCache):
|
|
default_timeout: int
|
|
key_func: Callable
|
|
key_prefix: str
|
|
version: int
|
|
cache_model_class: Any = ...
|
|
def __init__(
|
|
self,
|
|
table: str,
|
|
params: Dict[str, Union[Callable, Dict[str, int], int, str]],
|
|
) -> None: ...
|
|
|
|
class DatabaseCache(BaseDatabaseCache):
|
|
default_timeout: int
|
|
key_func: Callable
|
|
key_prefix: str
|
|
version: int
|
|
def get(
|
|
self,
|
|
key: str,
|
|
default: Optional[Union[int, str]] = ...,
|
|
version: Optional[int] = ...,
|
|
) -> Any: ...
|
|
def set(
|
|
self,
|
|
key: str,
|
|
value: Any,
|
|
timeout: Any = ...,
|
|
version: Optional[int] = ...,
|
|
) -> None: ...
|
|
def add(
|
|
self,
|
|
key: str,
|
|
value: Union[Dict[str, int], bytes, int, str],
|
|
timeout: Any = ...,
|
|
version: Optional[int] = ...,
|
|
) -> bool: ...
|
|
def touch(
|
|
self, key: str, timeout: Any = ..., version: None = ...
|
|
) -> bool: ...
|
|
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
|
|
def has_key(self, key: str, version: Optional[int] = ...) -> Any: ...
|
|
def clear(self) -> None: ...
|