nopCommerce Caching Guide: Redis, Memory & Static Cache Explained

Performance 9 Updated

nopCommerce Caching Guide: Redis, Memory & Static Cache

How nopCommerce 5.0 caches, from the per-request cache to Redis, which distributed type to choose for a web farm, and why a change sometimes does not show up.

The DistributedCacheType enumeration in the nopCommerce 5.00.1 source, with its four values memory, sqlserver, redis and redissynchronizedmemory, beside a large 4 and the words cache types

Key takeaways

  • nopCommerce 5.0 has a per-request cache for every request and a static cache that is in-process memory unless you switch on distributed caching.
  • Distributed caching has 4 types: memory, sqlserver, redis and redissynchronizedmemory. When you enable it, the default type is redissynchronizedmemory.
  • Run more than one app instance? Use a distributed type, or each server keeps its own copy of the cache.
  • nopCommerce caches data, not finished pages. Changes made through nopCommerce clear their own cache entries; direct SQL edits do not.

Caching decides whether a nopCommerce store survives a sale or slows down under ordinary browsing. Every page reads settings, the category tree, access rules, store mappings and localized strings, and caching keeps most of those reads out of the database.

This guide explains the layers, what changes when you add Redis, and why a change sometimes does not show up. We checked every setting and class name against the nopCommerce 5.00.1 source on 25 November 2026.

The Three Caching Layers in nopCommerce

The cache registrations in the nopCommerce 5.00.1 NopStartup class: a per-request short-term cache for every request, and the static cache that is memory by default or one of four distributed types when enabled

The cache wiring sits in one place, the NopStartup class. It registers PerRequestCacheManager as the short-term cache for every request. Then it registers the static cache: MemoryCacheManager by default, or a distributed manager when DistributedCacheConfig is enabled.

Layer Class in 5.00.1 Lives for
Per requestPerRequestCacheManagerOne HTTP request
Static, one serverMemoryCacheManagerThe app process, 60 minutes per entry by default
Static, sharedRedis, SQL Server or synchronized memoryShared by every instance

Your code does not see the difference. Services ask for IStaticCacheManager, and the configuration decides which implementation answers, so switching backends is a configuration change, not a code change.

Store slowing down under load? BSS tunes nopCommerce caching, hosting and code for stores that need to stay fast.

View nopCommerce services

Memory Caching: The Default

The MemoryCacheManager class and the 60-minute default cache time in the nopCommerce 5.00.1 source, with what that means for one server and for several

A fresh install runs on MemoryCacheManager, an in-process cache registered as a singleton. Reads never leave the process, so it is the fastest option, and CacheConfig keeps each entry for 60 minutes by default.

Its limit is scope, not speed. The cache lives inside one process, so it starts empty after a restart, and two app instances behind a load balancer each keep their own copy. An admin change clears the cache on the instance that handled it; the others serve the old value until their entries expire.

The web farm trap

If your store runs on more than one server, or more than one container replica, memory cache alone gives different answers from different instances. "I changed a setting and only some visitors see it" is the classic sign. It is a configuration gap, not something to fix in code.

From the BSS team

Before we change anything on a slow store, we ask one question: how many app instances serve it right now? If the answer is more than one and the cache is memory, that is usually the first fix.

Setting Up Redis as a Distributed Cache

The DistributedCacheConfig class in the nopCommerce 5.00.1 source with its defaults, RedisSynchronizedMemory as the type, distributed caching off, a local Redis connection string and a 500-millisecond publish interval, beside the summary of the Redis-synchronized memory cache

Distributed caching is built into nopCommerce; no plugin is needed. It is configured in App_Data/appsettings.json, in the DistributedCacheConfig section, and it is off by default.

"DistributedCacheConfig": {
  "Enabled": true,
  "DistributedCacheType": "redissynchronizedmemory",
  "ConnectionString": "your-redis-host:6379,password=your-password,ssl=True",
  "InstanceName": "nopCommerce",
  "PublishIntervalMs": 500
}

The 5.00.1 source offers four types. redis keeps the static cache in Redis, so every read is a network round trip. redissynchronizedmemory, the default when you enable the section, keeps reads in each server's local memory and uses Redis to tell the other servers what changed. sqlserver stores the cache in a database table (SchemaName and TableName), and memory uses ASP.NET Core's distributed memory cache.

Two settings are easy to miss. InstanceName partitions one Redis server between apps, such as staging and production. PublishIntervalMs batches the change messages that synchronized memory sends, every 500 milliseconds by default; set it to 0 to send each one at once.

Your setup Use Why
One app instanceDefault memory cacheFastest, nothing to run
Two or more instances, Redis availableredissynchronizedmemoryLocal-speed reads, shared invalidation
Two or more instances, no RedissqlserverShared cache in the database you already run

Put Redis in the same region as the app servers, and restart the app after editing the file. If your hosting is still being planned, our nopCommerce hosting guide covers the server side.

Data Cache vs Page and Asset Caching

Two real curl responses from the BSS store: the HTML page comes back no-cache, no-store and bypasses the CDN, while a product thumbnail comes back with a one-year public cache and a CDN hit

"Static cache" sounds like whole cached pages, but in nopCommerce it means application data: settings, categories, access rules and similar objects. The page is still built on every request, only from mostly cached data.

Our own store shows the split. A blog page comes back with Cache-Control: no-cache,no-store and the CDN passes it straight through. A product thumbnail comes back with Cache-Control: public, max-age=31536000 and a cache HIT at the edge.

So the layer above the data cache is ordinary web infrastructure: long cache headers on images, versioned CSS and JavaScript bundles, and a CDN in front. Our image optimization guide covers the image side.

How Cache Invalidation Works, and Where It Breaks

The CacheEventConsumer in the nopCommerce 5.00.1 source, which listens for entity inserted, updated and deleted events and removes cache entries by prefix, with the scheduled task that clears the whole static cache

nopCommerce ties invalidation to entity events. CacheEventConsumer listens for inserted, updated and deleted events on each entity, and removes the related entries by key prefix, so one change clears every cached list that contains that entity.

There is also a scheduled ClearCacheTask that clears the whole static cache, and a Clear cache button in the admin header for doing it by hand.

Where a stale cache comes from

  • SQL scripts and direct database edits raise no entity events, so nothing clears the cache. Click Clear cache afterwards.
  • A plugin that keeps its settings in a private static field will not see changes; cache through IStaticCacheManager instead.
  • Several instances on the default memory cache show a change on one server only. Switch to a distributed type.
  • Two environments sharing one Redis server without different InstanceName values can read each other's entries.
From the BSS team

After a migration or a bulk import that ran straight against the database, we click Clear cache before anyone tests the store. It saves an hour of chasing data that is already correct in the database.

Frequently Asked Questions

What caching does nopCommerce use by default?
A per-request cache for each request and an in-process memory cache, MemoryCacheManager, for static data. Distributed caching is off until you enable it in App_Data/appsettings.json.
Does nopCommerce support Redis?
Yes, with no plugin. Set DistributedCacheConfig to enabled and choose the redis or redissynchronizedmemory type with a connection string in App_Data/appsettings.json, then restart the app.
What is redissynchronizedmemory in nopCommerce?
It is the default distributed type in nopCommerce 5.0. Each server keeps the cache in its own memory for fast reads, and Redis carries the change messages so every server drops the same stale entries.
Do I need Redis for a single-server store?
No. With one app instance the default memory cache is the fastest option. A distributed cache matters once two or more instances serve the store.
Why does a change not show up on my nopCommerce store?
Usually because the data changed outside nopCommerce, such as a SQL script, or because several instances run on memory cache. Click Clear cache in the admin header, and use a distributed cache for more than one instance.

Final Thoughts

nopCommerce's caching is well designed: one interface, a per-request layer and a static layer whose backend is a configuration choice. Most cache problems we see come from a mismatch, such as memory cache on a web farm, or data changed behind nopCommerce's back.

Count your instances, pick the backend from that, and clear the cache whenever data changes outside the admin. For the memory side of the same problem, see our high memory usage guide.

SM

Written by Sharif Md. Yousuf

Software Engineer · Bangladesh Software Solution

Software Engineer at BSS in Dhaka, working on engineering projects including the tooling behind these blogs.

Read nextPerformance nopCommerce High Memory Usage Fix 12 min read