From 5df0dd09590fdcb067ded9a32abea5561fcd5ba4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 25 Jul 2024 20:22:11 +0530 Subject: [PATCH] Add type definition for DiskCache --- kitty/fast_data_types.pyi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index 0d28c061c..1e3e87519 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -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: ...