Full-page caching can significantly reduce the amount of server-side processing required to serve a PrestaShop storefront. However, implementing it correctly is more complicated than storing generated HTML and returning it whenever the same URL is requested.
Consider a product page that loads quickly after full-page caching is enabled. An anonymous visitor sees the correct price, but a returning customer sees an outdated cart counter. Another visitor switches currencies and receives a price intended for a different storefront context. Meanwhile, the performance monitoring tools indicate that server response times have improved.
These are hypothetical examples, but they illustrate an important distinction in ecommerce caching: performance and response correctness are separate concerns. A cache hit demonstrates that a stored response was reused. It does not establish that the response was appropriate for the current request.
To debug full-page caching effectively, developers need to understand what work is being avoided, how cached responses are selected, which content must remain dynamic, and when previously generated HTML becomes invalid.
Understanding what a cache hit actually bypasses
When PrestaShop receives a request for a product or category page, generating the final HTML may involve several application layers. PHP executes application logic, retrieves catalog information from the database, processes pricing and customer context, executes module hooks, and renders templates through Smarty.
Without full-page caching, much of this processing may be repeated for subsequent requests, even when the resulting page is substantially identical.
A full-page cache introduces an opportunity to reuse the final HTML response before completing the normal rendering process.
Uncached request or cache miss:
HTTP request
↓
PrestaShop application
↓
PHP logic, SQL queries and module hooks
↓
Smarty template rendering
↓
Generated HTML
↓
HTTP response
When a valid cached response is available, the processing path can become considerably shorter.
Cache hit:
HTTP request
↓
Cache eligibility and matching
↓
Retrieve cached HTML
↓
HTTP response
The exact interception point depends on the caching implementation, but the underlying principle remains the same: avoid repeating work whose output can safely be reused.
This is different from optimizing database queries, caching individual objects, or reducing template compilation overhead. Those techniques reduce the cost of particular operations during page generation. Full-page caching can avoid substantial parts of page generation altogether.
The distinction also explains why full-page caching can improve Time to First Byte (TTFB) without necessarily resolving slow JavaScript execution, oversized images, or other browser-side performance problems. The fundamentals of full-page caching in PrestaShop provide additional context on this relationship between HTML reuse and server-side workload.
The same URL does not always represent the same response
A common source of caching problems in ecommerce applications is treating URL equality as response equality.
Imagine the following product URL:
https://shop.example.com/42-running-shoes.html
Two visitors requesting this URL may require different HTML responses. One may be browsing in EUR, while another uses USD. A wholesale customer may receive different pricing from a regular customer. An authenticated customer may also require content that should never appear in an anonymous visitor's response.
Depending on the storefront configuration, several dimensions can influence the generated HTML:
| Context dimension | Potential impact on the response |
|---|---|
| Shop | Catalog, branding and configuration |
| Language | Translated content |
| Currency | Displayed prices and currency formatting |
| Country | Taxes and applicable pricing rules |
| Customer group | Group-specific prices and discounts |
| Cart state | Cart indicators and related content |
| Device type | Device-dependent markup, where applicable |
Not every store requires a separate cached response for every dimension. The relevant question is whether changing a particular dimension changes the HTML that is intended to be shared.
Conceptually, a cache identity might be represented as follows:
cache_identity = hash(
page_url,
shop,
language,
currency,
country,
customer_group
)
This is an illustrative model rather than the actual implementation of a particular PrestaShop cache module.
If a cache identity omits an important dimension, incompatible requests may retrieve the same stored response. Conversely, including unnecessary dimensions fragments the cache, reducing the number of requests that can reuse each entry.
Private customer information requires particular care. Separating responses by customer group, for example, does not make account details safe to share among customers in that group. Such information should remain outside shared cached HTML or be handled through an appropriately isolated response.
The same distinction applies to caching outside the application. A correctly configured PrestaShop page cache can still produce incorrect storefront behavior if a reverse proxy or CDN independently shares personalized responses. The HTTP caching guide from MDN explains how shared caches, private caches, and response variation interact.
Separate reusable HTML from visitor-specific content
Adding more dimensions to the cache identity is not always the appropriate solution. Some information changes too frequently, or is too specific to an individual visitor, to be included in reusable HTML.
A product page provides a useful example. Its description, images, specifications, and general layout may remain stable across many requests. Its cart counter, customer greeting, personalized offers, and certain module-generated prices may not.
Instead of generating an entirely separate product page for every visitor state, a caching architecture can separate reusable markup from content that needs to be retrieved or rendered independently.
Product page
│
├── Reusable HTML
│ ├── Product title
│ ├── Product description
│ ├── Product images
│ └── General page structure
│
└── Context-dependent content
├── Cart information
├── Customer information
├── Context-dependent prices
└── Personalized module output
Depending on the implementation, selected sections may be refreshed through AJAX or excluded from the shared caching process.
This introduces an additional debugging consideration. The initial HTML document and the final page displayed by the browser may contain different values. When dynamic content is incorrect, inspecting only the rendered page can make it difficult to identify whether the error originated in the cached document or in a subsequent request.
Browser developer tools allow these stages to be examined separately. Inspect the initial document response in the Network panel, then examine any subsequent requests responsible for updating dynamic sections. Compare their responses with the expected customer, currency, and cart context.
If the initial HTML contains an incorrect value that is later replaced, investigate the cached markup and whether that value should be present in it at all. If the initial document is appropriate but a later request introduces incorrect data, investigate the dynamic-loading mechanism instead.
This distinction is especially useful for custom modules that generate visitor-dependent output through PrestaShop hooks. Where compatibility cannot be established, excluding the affected output or page from full-page caching is preferable to allowing incorrect or private data to be reused.
Establish whether requests are actually reaching the page cache
Before investigating cache variations or invalidation, establish that the requests under examination are producing full-page cache hits.
A common mistake is to enable caching, reload a page, and assume that a shorter response time confirms the cache is working. Other layers, including browser caching, database caching, CDN caching, or PHP opcode caching, may also influence response times.
Start with a controlled test on a staging environment. Select an eligible product or category page, clear the relevant full-page cache entry, and make several requests while preserving the same visitor context.
The following example uses curl to capture response headers, HTML, and timing information while maintaining cookies between requests:
URL="https://shop.example.com/42-running-shoes.html"
COOKIE_JAR="cache-test.cookies"
for i in 1 2 3 4 5; do
curl -sS --compressed \
-b "$COOKIE_JAR" \
-c "$COOKIE_JAR" \
-D "headers-$i.txt" \
-o "response-$i.html" \
-w "Request $i | HTTP %{http_code} | TTFB %{time_starttransfer}s | Total %{time_total}s\n" \
"$URL"
done
The time_starttransfer measurement reports the elapsed time until curl begins receiving the response. It includes connection-related overhead, so it should not be interpreted as pure PHP execution time.
The first request after clearing the relevant entry may require page generation. Subsequent compatible requests should have an opportunity to reuse the generated HTML, provided the page is eligible and the visitor context remains stable.
Inspect the stored response headers:
grep -Ei '^(HTTP/|age:|cache-control:|vary:|x-cache:|cf-cache-status:)' \
headers-*.txt
These headers are useful when the relevant caching layers expose them, but their meaning is implementation-dependent. A CDN cache hit, for example, does not prove that the PrestaShop application-level page cache was used. Likewise, the absence of an X-Cache header does not establish that full-page caching is disabled.
Use cache-specific diagnostics, application logs, or available cache-hit records to confirm which layer handled the request. Timing measurements are valuable supporting evidence, but they are not a substitute for identifying the actual cache behavior.
Reproduce context-related failures systematically
Once cache hits are confirmed, the next step is to determine whether cached responses are being reused across incompatible storefront contexts.
Testing this requires more than repeatedly refreshing a page in a single browser session. That approach primarily verifies reuse within one context and may never expose a cache isolation problem.
Create independent browser profiles or cookie sessions, then change one relevant variable at a time. Keeping other variables stable makes it easier to identify which dimension influences an incorrect response.
A practical test matrix might look like this:
| Test | Context change | Expected behavior |
|---|---|---|
| A | Same anonymous context | Compatible response can be reused |
| B | EUR to USD | Currency and displayed prices remain correct |
| C | Default to another language | Content appears in the selected language |
| D | Regular to wholesale customer | Group-specific pricing remains correct |
| E | Empty to populated cart | Cart information reflects the current session |
| F | Anonymous to authenticated customer | Private information remains isolated |
| G | Shop A to Shop B | Shop-specific content remains correct |
Use the store's normal mechanisms to establish these contexts. For instance, changing an Accept-Language header alone may not reproduce a language switch if the storefront determines language through URLs or cookies.
For each test, compare the cache-enabled response with the expected response obtained without full-page caching. Examine meaningful fields rather than requiring the entire HTML document to be byte-for-byte identical. Dynamic tokens, timestamps, and other request-dependent values may legitimately differ.
The order of requests also matters. Warm the cache using one context, then request the page using another. Repeat the experiment in reverse order. If the incorrect value consistently matches whichever context generated the cached response first, an insufficiently differentiated cache identity becomes a strong candidate for investigation.
A different pattern may indicate a different cause. If the initial HTML is correct but the cart counter becomes incorrect after a subsequent request, the dynamic-content layer is a more appropriate starting point.
Distinguish incorrect cache variations from stale cache entries
Incorrect cached content does not always indicate a problem with cache matching. The correct response may have been stored for the correct context but become outdated after a change in the underlying store data.
This is where cache expiration and invalidation serve different purposes.
A cache lifetime determines when a stored response expires. Invalidation removes or marks an existing response as unusable when a relevant change occurs. The first mechanism limits how long cached content can remain reusable; the second addresses changes that should become visible before the normal expiration time.
Consider a product whose price is updated from the PrestaShop back office. A previously cached product page may still contain the original price. A cached category page displaying that product may also contain outdated pricing.
Clearing only the product page entry may therefore be insufficient. The developer must consider other cached responses that depend on the modified product data.
A useful debugging sequence is to warm the relevant pages, change one product attribute in a staging environment, and request the affected pages again without performing a manual cache clear.
| Observation | Area to investigate |
|---|---|
| Different visitors receive another context's price | Cache identity or response isolation |
| All visitors receive the previous price after an update | Cache invalidation or expiration |
| Product page is current but category listing is outdated | Invalidation of dependent pages |
| Initial HTML is correct but a dynamic section is wrong | Dynamic-content request or module behavior |
| Correct content appears after clearing only the CDN | Another cache layer, such as a CDN or reverse proxy, is still serving the outdated response |
Conclusion
Debugging full-page cache problems is mostly a matter of asking the right question in the right order. First, confirm whether the request actually reached the page cache. Then check whether the cached response belongs to the correct context. Finally, decide whether the content is wrongly shared or simply outdated, which points to cache identity in the first case and to expiration or invalidation in the second.
Working through these checks one at a time, ideally in a staging environment, keeps cache-related issues from being treated as a single vague "cache problem" and makes each fix easier to verify.


Top comments (0)