Search code examples
flaskcachingcloudflare

How to cache dynamic content of my website


I have a website developed using Flask framework. I want to cache all my pages to make my website faster and increase traffic on search engines. However, the page has user-specific dynamic content. I would really appreciate it if you could tell me how to cache dynamic content.


Solution

  • I solved this dynamic content caching problem using ajax requests for user-specific data. After loading static content, I requested user-specific data such as current user information via ajax. I set cache option to false when making ajax request. In this way, I can solve the dynamic content caching problem.