title: Caching Dynamically Generated Pages
body: <p>We are looking to speed up our website. More specifically, we are looking to lower TTFB. Our website consists mainly of pages that are dynamically generated based on the url path (a subject is extracted) and on parameters in the url path.
  These entries are put into an sql query that pulls in all the right data from our database executed with php.</p>
  
  <p>Here is the issue:</p>
  
  <p>These queries work perfectly to generate the pages and all the information associated with them (e.g. tags).
  However, rerunning the code everytime a visitor goes to a page takes a significant amount of time, resulting in a high TTFB/server response time. In essence, these pages only need to be updated using the sql queries once every month. In between that, it should be possible to serve them as preloaded/pregenerated static HTML pages (until we indicate a refresh). We are currently using Cloudflare as a CDN which has been great in speeding up the website already. Now, even though we have the page rule with "Cache Everything" on, we can still see it reruns the php code including sql queries.</p>
  
  <p>The question:</p>
  
  <p>Does anybody know a good way to accomplish this goal of caching the dynamic part of the website? Whether that's with Cloudflare, or via another way? I know that Akamai offers this service but evidently, there is some switching cost associated with swapping the website to another CDN, and we are rather satisfied with Cloudflare.</p>
  
  <p>Thanks in advance!</p>