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

前端 未结 8 1104
情深已故
情深已故 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:13

    If a proxy cache is out of the question, and you're serving complete HTML files, you'll get the best performance by bypassing PHP altogether. Study how WP Super Cache works.

    Uncached pages are copied to a cache folder with similar URL structure as your site. On later requests, mod_rewrite notes the existence of the cached file and serves it instead. other RewriteCond directives are used to make sure commenters/logged in users see live PHP requests, but the majority of visitors will be served by Apache directly.

提交回复
热议问题