Skip to content

glide_shared.commands.memory

Response models and parsing helpers for MEMORY STATS command.

MemoryStatsDb dataclass

Database memory overhead statistics from MEMORY STATS.

Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/memory.py
11
12
13
14
15
16
@dataclass
class MemoryStatsDb:
    """Database memory overhead statistics from MEMORY STATS."""

    overhead_hashtable_main: int
    overhead_hashtable_expires: int

MemoryStats dataclass

Represents a MEMORY STATS response.

Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/commands/memory.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@dataclass
class MemoryStats:
    """Represents a MEMORY STATS response."""

    db: Dict[int, MemoryStatsDb] = field(default_factory=dict)

    allocator_active: int = 0
    allocator_allocated: int = 0
    allocator_fragmentation_bytes: int = 0
    allocator_resident: int = 0
    allocator_rss_bytes: int = 0
    aof_buffer: int = 0
    clients_normal: int = 0
    clients_slaves: int = 0
    dataset_bytes: int = 0
    fragmentation_bytes: int = 0
    keys_bytes_per_key: int = 0
    keys_count: int = 0
    lua_caches: int = 0
    overhead_total: int = 0
    peak_allocated: int = 0
    replication_backlog: int = 0
    rss_overhead_bytes: int = 0
    startup_allocated: int = 0
    total_allocated: int = 0

    allocator_fragmentation_ratio: float = 0.0
    allocator_rss_ratio: float = 0.0
    dataset_percentage: float = 0.0
    fragmentation: float = 0.0
    peak_percentage: float = 0.0
    rss_overhead_ratio: float = 0.0

    # Optional Redis 7.0+ fields
    cluster_links: Optional[int] = None
    functions_caches: Optional[int] = None

    # Optional Valkey 8.0+ fields
    allocator_muzzy: Optional[int] = None
    db_dict_rehashing_count: Optional[int] = None
    overhead_db_hashtable_lut: Optional[int] = None
    overhead_db_hashtable_rehashing: Optional[int] = None