Bug report: new page_rules transient issue with memcached
-
https://gist.github.com/mircobabini/a099e94e3010ac13c5641427da2ad5dc#file-page_routes-php-L130-L132
The highlight rows are checking when all the 3 transients expired. But this is buggy, because the transient related to the $pages can expire even earlier, then that condition would NOT be met. And this is wrong.
This can happen because when setting the transients with the expire time, you are specifying a maximum expire time. When you have memcached enabled, any of these transient can expire BEFORE the others.
So, instead of checking if ALL of these are expired, you should check if ANY of these is expired. Remove the AND (&&) and use the OR (||) in that condition.
If you need more details about how transient works in WordPress, please refer to the official documentation which says:
Furthermore, it is possible for the transient to not be available before the expiration time. Much like what is done with caching, your code should have a fall back method to re-generate the data if the transient is not available.
Ryan McCue explained it this way on a ticket:
Everyone seems to misunderstand how transient expiration works, so the long and short of it is: transient expiration times are a maximum time. There is no minimum age. Transients might disappear one second after you set them, or 24 hours, but they will never be around after the expiration time.
- The topic ‘Bug report: new page_rules transient issue with memcached’ is closed to new replies.