Background Info
I sell WordPress themes where I include a Twitter widget. In the widget I use a WordPress transient that refreshes every 3 hours to cache the Tweets. I’ve got thousands of people using this and it seems to work for just about everyone. Also, I’ve done little tests on my end to ensure I know the cache is working properly with how I have everything setup.
However, I’ve run into maybe 2 or 3 buyers where it’s apparent that the cache is not working at all on their servers.
Note: I can tell because they keep getting timeout issues as they’re hitting the Twitter API more than the allowed 150 times in an hour.
The Question
So, are there any reasons why someone’s specific web server could have problems with WordPress transients? Or maybe something specific to someone’s WordPress configuration? Is there anything else I could be overlooking?
I had a similar problem once with an aggressive database cache: the first check for an existing transient returned nothing â which was okay â but after I created the transient, I didnât get it, because the empty cached result was always returned. So I built a dozen duplicated transients until I found the issue.
Ask your clients if it happens after they disabled the data base cache. You could filter the
'query'
and insert aSQL_NO_CACHE
before you check the transient. Make sure to remove the filter afterwards.I had the same issues while checking for updates. It seems that on some hosts transients do not work. And I think it’s a problem with the Object Cache.
The normal behaviour is that WordPress saves the transients into the MySQL Database. The value of the transients will be saved as well as the timestamp. If you call a transient with the
get_transient()
function, WordPress will check if the transient in the database is still valid. If not, it will delete the transient.I’ve recognized that this only happens if a customer uses the Object Cache (maybe through an Drop-In-Plugin like the Memcached plugin). I think that is because of a misconfiguration of Memcached. The Object Cache runs out of space and therefore requests for new data with every pageload.
Hopefully I can test this in the near future to provide more information about that.