3

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?

2 Answers 2

1

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 a SQL_NO_CACHE before you check the transient. Make sure to remove the filter afterwards.

2
  • I'm sorry, but I'm just not following this. What on someone's server would prevent WordPress's caching system from working? How would someone disable their database cache? Keep in mind that this would probably something inadvertent that the client has done. Most likely they're using some sort of hosting account that they've purchased and is already setup for them. I don't understand how WordPress transients work behind the scenes, but I'm just trying to figure out if it's possible some sort of sever or MySQL setting could be effecting this.
    – Jason
    Commented Feb 27, 2012 at 3:24
  • Install W3 Total cache, enable the query cache. This may be already the root of the problem. Another cause could be an aggressive MySQL cache. The regular WordPress cache doesn’t touch transients.
    – fuxia
    Commented Feb 27, 2012 at 4:37
1

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.

1
  • If you're trying to store a very large amount of data, then yes, some cache systems might reject it or not work. Transients are not meant as catch-all systems for holding large data sets. If you need to store anything verging on large, implement your own cache storage.
    – Otto
    Commented Dec 23, 2013 at 12:24

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.