1

I have recently switched from memcached to Redis. The cache, session, template caching and mutex is now using Redis on a project. While Redis generally gets managed by Yii/Craft CMS, Redis features a few more configuration options than memcached, so I was looking for any further insight/advice on the best configuration when used with Craft CMS.

The current data eviction policy which seems to be a default for most Redis provisioning is volatile-lru. There are other eviction policies available:

  • noeviction: New values aren’t saved when memory limit is reached. When a database uses replication, this applies to the primary database
  • allkeys-lru: Keeps most recently used keys; removes least recently used (LRU) keys
  • allkeys-lfu: Keeps frequently used keys; removes least frequently used (LFU) keys
  • volatile-lru: Removes least recently used keys with the expire field set to true.
  • volatile-lfu: Removes least frequently used keys with the expire field set to true.
  • allkeys-random: Randomly removes keys to make space for the new data added.
  • volatile-random: Randomly removes keys with expire field set to true.
  • volatile-ttl: Removes keys with expire field set to true and the shortest remaining time-to-live (TTL) value.

Based on my own assessment allkeys-lru, allkeys-lfu, volatile-lru and volatile-lfu and likely the best options, but any Redis experts care to comment on their take?

1 Answer 1

1

Based on my own assessment and looking at other resources, allkeys-lru is likely the best policy to use in many cases.

https://redis.io/docs/manual/eviction/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.