Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Where does WordPress default SimplePie save cache data? I could only find relevant info about cache durations but not the location. SimplePie has a method called set_cache_location() but I cannot find it being used in WordPress.

I'm writing a plugin and if a cache folder is available already by default, I'd like to use it rather than creating for my plugin.

Does anybody know it?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

In WordPress, the WP_Feed_Cache class uses the WP_Feed_Cache_Transient class to store the results into a transient.

So, short answer, either in the database or in the Object Cache if you have a persistent object cache stored.

If you need to cache something for a period of time, use a transient.

http://codex.wordpress.org/Transients_API

share|improve this answer
    
Thanks for the info. I looked into the source in feed.php and there are lines $feed->set_cache_class('WP_Feed_Cache'); $feed->set_file_class('WP_SimplePie_File'); It looks these are the ones setting a transient. I have a custom class which extends SimplePie which WordPress includes. In that case, can I just use these methods and simply pass the words, WP_Feed_Cache and WP_SimplePie_File? –  Teno Aug 30 '12 at 18:30
    
You should use set_transient described in the link above. –  Wyck Aug 30 '12 at 18:49
    
Do you mean I should use set_transient() separately from SimplePie? Or are you suggesting that I should implement the function into the custom extended class? –  Teno Aug 30 '12 at 18:57
    
As I test with my custom class extending the default WordPress SimplePie class, in addition to the above methods, set_cache_class('WP_Feed_Cache') and set_file_class('WP_SimplePie_File'), set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', $cacheduration, $url)) works fine without errors. –  Teno Aug 30 '12 at 19:23
    
If you're using it in your plugin, you do want to use set_cache_class() and set_file_class() there, not set_transient –  Ryan McCue Aug 31 '12 at 1:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.