开发者

Cache DB queries result

开发者 https://www.devze.com 2023-03-08 05:49 出处:网络
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

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 hi开发者_运维技巧ts to Db & processing time.

I initially 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. Please tell me whether it can fulfill my requirement or i should write my own logic.


Are you storing images in the database? Then you're doing it wrong, you should only store the path to the image.

More related to your answer, you'll probably want to look into http://dev.mysql.com/doc/refman/5.1/en/query-cache.html

Also, do you experience significant slowdowns due to DB queries? Judging by your post only, I'd say there are a lot of optimisations on the frontend that can speed up your website. I wrote a very comprehensive article at http://blog.hazardousgaming.info/129/drastically-improve-page-speed/

Note: I'm not using the blog for a few months now and moving to a new domain. This is not a spam post, just to much text to fit in here.

0

精彩评论

暂无评论...
验证码 换一张
取 消