Skip to content

Configure Disk Cache Eviction Strategy

Configure Disk Cache Eviction Strategy

OpenObserve allows you to configure how cached files on disk are evicted when the cache reaches its size limit. The eviction behavior is controlled by the ZO_DISK_CACHE_STRATEGY environment variable.

Set the disk cache eviction strategy using:

ZO_DISK_CACHE_STRATEGY=<strategy_name>

Supported Values

  1. lru or Least Recently Used (Default)

  2. How it works: Evicts the file that has not been accessed for the longest time.

  3. Use when: You want frequently accessed data to stay in cache longer, regardless of when it was added.
  4. Behavior:

    • Tracks access times.
    • Keeps recently used files in the cache.
    • Removes the oldest or the least accessed entries first.
  5. fifo or First In, First Out

  6. How it works: Evicts the oldest cached files in the order they were added, without considering how often they are used.

  7. Use when: You want a simple time-based cache cleanup that clears files strictly in order of arrival.
  8. Behavior:

    • Ignores access frequency.
    • Clears files in the same order they were cached.
  9. time_lru or Time-Grouped Least Recently Used

  10. How it works: Groups cached files by time windows such as hourly, then applies least recently used or LRU eviction within those windows.

  11. Use when: You need time-aligned cache control while still preserving frequently accessed files.
  12. Behavior:

  13. Groups files using time-based keys. For example, 2025040806.

  14. Evicts from the oldest time group first. Within that group, it removes the least recently accessed file.