Add type definition for DiskCache

This commit is contained in:
Kovid Goyal 2024-07-25 20:22:11 +05:30
parent 0813a3daff
commit 5df0dd0959
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -1698,3 +1698,18 @@ class MousePosition(TypedDict):
in_left_half_of_cell: bool
def get_mouse_data_for_window(os_window_id: int, tab_id: int, window_id: int) -> Optional[MousePosition]: ...
class DiskCache:
small_hole_threshold: int
defrag_factor: int
@property
def total_size(self) -> int: ...
def add(self, key: bytes, data: bytes) -> None: ...
def remove(self, key: bytes) -> bool: ...
def remove_from_ram(self, predicate: Callable[[bytes], bool]) -> int: ...
def num_cached_in_ram(self) -> int: ...
def get(self, key: bytes, store_in_ram: bool = False) -> bytes: ... # raises KeyError if not found
def size_on_disk(self) -> int: ...
def clear(self) -> None: ...