# SSR Cache

NOTE: Redis integration is disabled by default, toggle VSF_REDIS_ENABLED=true flag to activate connection.

In commercetools integration, we are caching some server-side rendered pages with Redis out of the box. To make use of it, you need to add the Redis configuration to the .env file in your project.

// .env


# What is cached

The pages that are cached are:

  • Home page with the Vhome tag.
  • Category page with the Vcategory tag and tags for products: P${prod._id} as well as categories C${cat.id}
  • Product page with the Vproduct-${route.value.params.id} tag and tags for the main product P${prod._id} as well as related products P${prod._id} and categories C${cat.id}

# Invalidating tags

To invalidate a tag and remove pages associated with that tag, use the Invalidation endpoint (opens new window).

Go to the route configured in the .env file under the VSF_REDIS_CACHE_INVALIDATE_URL key with two query parameters:

  • key — string matching the VSF_REDIS_CACHE_INVALIDATE_KEY key in the .env file.
  • tags — a comma-separated list of tags for invalidation.

Assuming that you are running the application locally, the VSF_REDIS_CACHE_INVALIDATE_URL key is equal to /cache-invalidate, and the VSF_REDIS_CACHE_INVALIDATE_KEY key is equal to secret_key, and you want to invalidate the Vhome tag, the full URL will look like this:

# How to cache other pages

We added caching only to the most visited pages. However, you can cache other pages as well, including custom ones. You can find detailed instructions on how to use cache on the SSR Cache (opens new window) and Redis cache (opens new window) pages.


You don't need to add any additional packages to cache more pages — just add or modify tags in components.