1 | | Perhaps I'm missing something fundamental, but it seems to me that (at least part of) the conversation here is focusing on the wrong thing - cache key TTL rather than having an appropriate cache eviction policy for the cache data (e.g. LRU, which I believe is the default for Redis). https://redis.io/docs/reference/eviction/ |
2 | | |
3 | | If you use something like allkeys-lru, then the only way actively-used keys could get evicted is if your cache is too small - a hosting error, not WP. If you do want to use TTL/expire on specific keys, then perhaps volatile-lru could be used. It seems to me that this decision should be up to the site owner, not WP Core. |
4 | | |
5 | | |
6 | | This all seems to rougly echo what Peter Wilson said in his initial comment: https://core.trac.wordpress.org/ticket/57625#comment:3 |
7 | | |
8 | | Perhaps a solution the present problems is to give users and plugins more control over caching policies such as whether to apply a TTL or not to a specific cache key? Also, to provide documentation/guidance on proper server cache (redis) config - both for users who manage their own servers, as well as for hosting providers to do a better job at. |
9 | | |
10 | | This article from Ruby on Rails goes into detail about using key-based cache expiration, so it seems worth reviewing for inspiration. |
11 | | https://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works |
12 | | |
13 | | I hope this is helpful rather than irrelevant/a distraction! |
| 1 | removed comment as I now see that this issue has been closed. Added my comments to #59592 |