Znode Storefront Caching Architecture and Performance Guide

TABLE OF CONTENTS

Overview

Overview

Storefront caching improves page rendering performance by reducing repeated processing and unnecessary requests to downstream services. Znode uses multiple independent caching layers throughout the request lifecycle, each designed to solve a specific performance challenge.

Understanding where caching occurs and selecting the appropriate cache layer is critical to ensuring performance improvements without introducing stale data, scalability concerns, or cache invalidation challenges.

Caching should be considered an architectural design decision rather than a late-stage optimization. 

Purpose

This article explains how caching operates within a Znode Storefront, how requests flow through cache layers, and how to determine the correct location for custom caching implementations.

Topics covered include:

  • Storefront caching architecture
  • Available cache layers
  • Cache-placement strategy
  • Platform cache versus custom cache decisions
  • Cache invalidation mechanisms
  • Store isolation and cache keys
  • Performance and scalability considerations

Storefront Caching Architecture

A Storefront request may pass through several independent caching layers before reaching Znode APIs. Each layer has its own responsibility, lifecycle, and invalidation process.

Primary Request Flow:

Browser
   ↓
CDN / Edge
   ↓
Middleware
   ↓
Page Assembly
   ↓
Page/Data Cache
   ↓
Znode APIs
   ↓
Render

Not every request traverses every cache layer. Static assets may be served entirely from the browser cache or CDN, while dynamic pages may assemble content through additional processing layers. 

Cache Layers

LayerPurposeTypical Lifetime
Browser CacheStatic assets such as JavaScript, CSS, fonts, and imagesPer browser session
CDN / Edge CacheShared public responsesShared infrastructure cache
Middleware RoutingRouting decisions onlyEvaluated per request
In-Process Portal CachePortal metadata, domains, redirects, theme information15 minutes
Page-Structure CachePrepared Page Builder page definitions1 hour by default
Next.js Data CacheTagged server-side fetch responsesTag-driven invalidation
Znode API Fetch CacheServer-side API fetch callsTag-driven invalidation

Page-structure caching and data caching solve different problems. Page-structure caching prevents repeated assembly of Page Builder content, while data caching prevents repetitive retrieval of reusable API data. Transactional and personalized information remains live. 

Page Builder Preview vs Storefront Behavior

Page Builder Preview

  • Reads current Page Builder content directly.
  • Does not use page-structure caching.
  • Represents the latest unpublished and published content state.

Customer Storefront

  • May utilize page-structure caching.
  • Reflects published content after cache invalidation or revalidation completes.
  • Always evaluates sessions, carts, pricing, authorization, and user-specific information dynamically.

Differences between previewed content and Storefront content do not automatically indicate an issue. Publish and cache invalidation events should be verified first. 

Use Case: Determine the Correct Cache Layer

The recommended approach is to cache information as close to the consumer as safely possible.

Decsion Process

  1. Determine whether the response can be safely reused by the browser.
  2. If not, determine whether the response can be shared through a CDN.
  3. If not, determine whether the page shell can be reused.
  4. If not, determine whether server-side data can be reused.
  5. If not, retain live request processing.

The goal is to cache at the nearest practical layer where the response remains reusable and correct. 

Data TypeRecommended Layer
JavaScript, CSS, FontsBrowser Cache
Portal MetadataIn-Process Portal Cache
Page Builder ContentPage-Structure Cache
Product Catalog DataTagged Data Cache
NavigationPage/Data Cache
Store ConfigurationPortal Cache
Cart DataLive Only
Checkout DataLive Only
Payment StateLive Only
User-Specific PricingPersonalized Runtime Processing
Live InventoryTypically Live

Transactional and personalized data should remain dynamic to ensure correctness. 

When to Use Caching

Caching should be considered when the following conditions apply:

  • The data is read frequently.
  • Retrieval requires expensive processing.
  • Some level of staleness is acceptable.
  • The same data is reused across multiple requests.
  • The information is not transactional or highly personalized.

Suitable examples include product catalogs, navigation structures, CMS content, SEO metadata, and store configuration settings. 

When Not to Use Caching

Shared caching should not be used for:

  • Payment state
  • Payment tokens
  • Checkout authorization
  • Customer carts
  • Sensitive personal information
  • Real-time transactional processing
  • Authoritative live inventory
  • Fully personalized responses

These values are evaluated on every request to ensure accuracy and security. 

Platform Cache vs Custom Cache

Platform Caching

Platform caching should be preferred whenever the response can be reused without introducing custom logic.

Examples include:

  • CDN caching for public pages
  • Page-structure caching for Page Builder pages
  • Tagged data caching for Znode API requests

New Page Builder page types automatically participate in platform page-structure caching once registered. 

Custom Redis Caching

Custom Redis caching is appropriate when:

  • Data originates from external services.
  • Information requires aggregation.
  • Results are shared across requests.
  • Page-level caching is not possible.
  • Custom BFF implementations repeatedly retrieve identical data.

Every custom cache implementation should:

  • Include store-specific key prefixes.
  • Define an explicit TTL.
  • Define an invalidation strategy.
  • Fail open when the cache is unavailable.

Cache outages should degrade to live retrieval instead of generating application failures. 

Cache Placement Decision Tree

For high personalized responses, cache only reusable portions of the response and merge personalized data during rendering. 

Cache Key Standards

{app}:{environment}:{storeId}:{entity}:{identifier}:{facet}:{version}

Examples

znode:prod:12:product:SKU-1234
znode:prod:12:product:SKU-1234:pricing:v2
znode:prod:12:page:home
znode:prod:12:category:electronics:nav

Store-specific key scoping is required to ensure correct tenant isolation, security, and targeted invalidation. 

Cache Invalidation

Caching must always include a corresponding invalidation strategy.

Typical Prouct Update Invalidation

  • Product cache
  • Pricing cache
  • SEO cache
  • Category listing cache
  • Product detail page cache

Derived data must also be invalidated whenever source data changes. 

Platform Invalidation Mechanism

Publish and update events generate cache invalidation actions that:

  • Trigger tagged-data cache revalidation.
  • Remove affected page-structure cache entries.
  • Broadcast cache-eviction events to all application instances.

This approach ensures consistency across multiple Storefront instances. 

Middleware Performance Best Practices

  • Exclude static assets from middleware execution.
  • Execute inexpensive checks before network calls.
  • Validate sessions locally whenever possible.
  • Use bounded in-process caches for portal metadata.
  • Apply memory limits and controlled eviction strategies.
  • Use short-lived negative caching for unknown hosts.

Because middleware executes before most cache layers, inefficient middleware can negate caching benefits throughout the application. 

Best Practices

  • Cache at the nearest practical layer.
  • Prefer CDN caching before implementing Redis caching.
  • Cache reusable content rather than personalized responses.
  • Always scope cache keys by store.
  • Always define cache expiration policies.
  • Always define cache invalidation processes.
  • Avoid using caching to mask architectural inefficiencies.
  • Validate cache effectiveness using real performance measurements.

A properly designed caching strategy reduces downstream processing costs, improves response times, and scales efficiently without compromising data correctness. 

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.