I'm currently using the Transients API to cache some product details from Amazon. Now I'm looking into adding a file system cache. But I have no idea how to implement it. The only thing that I can think of is to actually save the JSON string representation of a specific product into a text file. Is this worth it? Are there any proven performance benefits when doing this or does it have the same performance to that of the database? Thanks in advance.

1 Answer 1


Some of caching APIs in WordPress, including transients, can make use of swappable Object Cache backend. There are ready-made implementations around for it which use file system as storage engine.

However determining if it's worth it is another matter entirely. In usual case database is very likely to outperform disk for typical caching tasks. However there are combinations of factors out there that might make disk preferable (when data gets prohibitively large for individual database entries, etc).

Unless you can practically benchmark and determine limitations of your current setup it's unlikely that you need dedicated file cache.

PS note that more commonly Object Cache backends use memory caches (APC, Memcache, Redis) and that unsurprisingly tends to outperforms database and disk either for caching tasks

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.