File Cache via Ajax

When requesting a page via ajax, the file cache always generates a new version.

Here is a gif showing the plainkit index page first being requested with a hard refresh. The page is cached properly, and on subsequent loads, the page is rendered from cache. However, as soon as the page is requested via ajax (the title is a hyperlink that fetches the page with an ajax request and replaces the content), a new cache file is generated. On subsequent requests, the page is continually re-cached.

Has anyone ran into this or similar?

The cache file name is based on the URL of the request. So that depends on your AJAX setup. If the URLs are all unique (for example if you pass a unique value like a timestamp), the cache will re-generate every time.

1 Like

Yep, was just coming to close this issue. The ajax request was dumping the cache due to timestamp. Thanks!