Hasty Briefsbeta

Bilingual

<antirez>

7 hours ago
  • Redis evicts old data when memory limit is reached, using policies like LRU and LFU.
  • LRU (Least Recently Used) evicts keys with the greatest idle time, approximated by random sampling of keys.
  • LFU (Least Frequently Used) evicts keys with the least number of accesses, using a logarithmic counter and time-based decay.
  • Improvements include a pool of eviction candidates to avoid trashing good data and cross-database eviction.
  • The 24-bit metadata field stores either LRU clock or LFU counter and last decrement time.
  • New keys start with a base LFU value to avoid immediate eviction.