How do I implement a HTML cache for a PHP site?

前端 未结 8 1132
情深已故
情深已故 2020-12-14 22:49

What is the best way of implementing a cache for a PHP site? Obviously, there are some things that shouldn\'t be cached (for example search queries), but I want to find a go

8条回答
  •  醉酒成梦
    2020-12-14 23:22

    The best way to go is to use a proxy cache (Squid, Varnish) and serve appropriate Cache-Control/Expires headers, along with ETags : see Mark Nottingham's Caching Tutorial for a full description of how caches work and how you can get the most performance out of a caching proxy.

    Also check out memcached, and try to cache your database queries (or better yet, pre-rendered page fragments) in there.

提交回复
热议问题