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.

On my new site i am displaying most of the images instead of text. I show images for recently written, recently viewed, mostly viewed posts etc. I found that in 40% of cases posts are same. so i need not to hit the DB to extract the image. It can save number of hits to Db & processing time.

I intially thought to cache post IDs. So before querying to DB or processing contents to extract image, i can search for post id into cache. If post id found in cache then i can directly show image from disk.

I found that there are many of the plugins who cache DB queries and their result. I am using wp-total cache. Please tell me whether it can fulfill my requirement or i should write my own logic

share|improve this question
    
did you make sure that Database Cache is enabled? –  Bainternet May 25 '11 at 15:44
    
@Bainternet my plugin can be used any person. and i can check for only me. I m asking whether wp total cache can fulfill my need –  articlestack May 26 '11 at 2:06
    
Well if that is the question then yes its good for your needs. –  Bainternet May 26 '11 at 5:42
    
Do you mean you use code like get_post_thumbnail() to get the featured images of the posts? Many of these API functions use an internal cache, so if you call them multiple times on the same page they only query the database once. Can you edit your question to include some example code? –  Jan Fabry May 27 '11 at 14:26
    
NO. I had written my own function to extract the image from post. My question is whether i should write code for caching or plugins like w3 total cache, super cache etc can do it automatically –  articlestack May 27 '11 at 18:25

1 Answer 1

up vote 2 down vote accepted

As long as you use WP API ($wpdb) to perform queries, they will be cached by caching plugins (well, by those that have such functionality).

If you need to cache data that is more compelx to generate rather than just retrieve look into Transients API.

share|improve this answer
    
I think i must write my own mechanism for caching. if there is some plugin who does it automatically it'll not degrade performance at all. Thanks to suggest me Transients API –  articlestack Jun 2 '11 at 15:36

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.