How To Implement A PHP/HTML Cache

前端 未结 4 1628
挽巷
挽巷 2021-01-03 13:18

I\'ve read several guides on implementing a php cache system (my site is custom coded, fairly query heavy and growing) including this one: http://www.snipe.net/2009/03/quick

4条回答
  •  余生分开走
    2021-01-03 13:56

    Why can't you cache them? If it's because they change very rapidly, then you're probably better off trying to reduce the retrieval and rendering overhead.

    If the contents vary according to the user, then you can offer up different cached versions per user. If you're using an object cache, for example, then include the user's identifier or some other unique value in the cache key. If you're using a more generic, HTTP-level cache such as Squid, then you can set the Vary header to, e.g. Vary: Cookie, which will cause the proxy to double-check who it's serving content to.

    You should still instruct caches and proxies not to store any sensitive information in public caches.

提交回复
热议问题