Blog Sections Open

Serving AJAX Variants with Separate Cache Logic

If one URL needs both a full-page response and an AJAX-only response, treat them as different cache contexts instead of hoping one cache file can safely serve both.

A classic Evolution CMS trap appears when the same resource has to answer both a normal page request and an AJAX request with a different template or partial output. If both flows share the same cache identity, one version can poison the other.

The core principle

AJAX output should have its own cache strategy. If you need radically different output, do not rely on the same cached resource file that the full page uses.

Typical options

  • make the AJAX response uncached
  • route the AJAX request through a separate endpoint or snippet
  • introduce a query-aware cache key in your own layer

What not to do

Do not switch templates “on the fly” and expect stock page cache to keep both versions straight automatically. That usually works only until the wrong version is cached first.

Recommendation

Separate page rendering and AJAX rendering deliberately. It is easier to reason about, easier to invalidate, and much safer under load.

Newer post

When Easy2 Gallery Queries Overload the Database

How to interpret repeated Easy2 gallery queries that copy to temporary tables and push a hosting database into critical load.

Older post

Allowing Duplicate Aliases Only Across Different Parents

Duplicate aliases are useful when two different branches share the same product naming, but they still need to stay unique within the same parent.