Working with Object Inspection
1. Getting Object Encoding
| Command | Purpose |
OBJECT ENCODING key | Internal representation (varies by size/type) |
2. Getting Object Frequency
| Command | Requires |
OBJECT FREQ key | LFU policy (allkeys-lfu/volatile-lfu) |
3. Getting Object Idle Time
| Command | Requires |
OBJECT IDLETIME key | LRU policy; seconds since last access |
4. Getting Object Reference Count
| Command | Description |
OBJECT REFCOUNT key | Internal refcount; shared integers return large values |
5. Getting Object Help
| Subcommand | Lists |
OBJECT HELP | All OBJECT subcommands with descriptions |
6. Understanding Internal Encodings
| Type | Encodings |
| String | int, embstr (≤44 bytes), raw |
| List | listpack (small), quicklist |
| Hash | listpack, hashtable |
| Set | intset, listpack, hashtable |
| Sorted Set | listpack, skiplist |
| Stream | stream (radix tree of listpacks) |
7. Understanding List Encodings
| Setting | Default | Effect |
list-max-listpack-size | -2 (8KB) | Per-node size; negative = bytes |
list-compress-depth | 0 | Compress quicklist interior nodes |
8. Understanding Hash Encodings
| Setting | Default | Effect |
hash-max-listpack-entries | 128 | Threshold → switch to hashtable |
hash-max-listpack-value | 64 | Max element byte size |
9. Understanding Set Encodings
| Setting | Default | Effect |
set-max-intset-entries | 512 | All-int sets → intset |
set-max-listpack-entries | 128 | Mixed small sets → listpack |
set-max-listpack-value | 64 | Max value byte size in listpack |
10. Understanding Sorted Set Encodings
| Setting | Default | Effect |
zset-max-listpack-entries | 128 | Switch threshold to skiplist |
zset-max-listpack-value | 64 | Max element byte size |
Note: Keep aggregates small to retain compact encodings — large memory savings vs hashtable/skiplist.