The cache will keep itself “fresh”. If you like to flush it every x hours, you can do that using wp_cache_flush().
Ideally allocate more memory to Redis, so you can cache everything and key don’t flight for space.
Thank you for the info @tillkruess
That leads me to next questions as below.
What will happen if the memory gets full? it will wipe off the oldest data to clear up the space for the new incoming data?
What I have experienced so far is that the system (site) gets freezed whenever it hits the max memory. that’s the reason of I am checking to clear the object cache in regular basis to avoid the site breakdown.
Please advise me on this.
Thank you
What will happen if the memory gets full? it will wipe off the oldest data to clear up the space for the new incoming data?
That depends on your configuration of Redis Server. You can set a maxmemory-policy in your redis.conf file to get Redis Server to evict old keys when memory nears maximum. Ideally tho, allocate more memory to Redis Server so it holds all cache data.
yes, I got that.
I have set it volatile-lru, so i wud expect it clear the old dataset when the memory gets full, right?
but it’s again making the site freezed from time to time with 2gb max memory.
now I increased it to 4gb and monitor it.
Either it works well or not, it proves that old data doesn’t get cleared off.
any input wud be appreciated.
Did you restart the Redis process after making changes to the redis.conf?
yes of course. Multiple times.
What does your redis error log say after a freeze?