b2c-custom-caches

Define caches in caches.json and access them via CacheMgr for B2C Commerce cartridges.

51|16|Updated Oct 31, 2025
One-click install
npx skills add https://github.com/SalesforceCommerceCloud/b2c-developer-tooling --skill b2c-custom-caches
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: b2c-custom-caches
Source: https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/tree/main/skills/b2c/skills/b2c-custom-caches
Command: npx skills add https://github.com/SalesforceCommerceCloud/b2c-developer-tooling --skill b2c-custom-caches

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Custom caching reduces repeated expensive calculations and external calls by storing data in application-local caches, improving response times and reducing load on back-end services.

Core Features & Use Cases

  • Define caches in caches.json within a cartridge to declare cache IDs and expiration.
  • Access caches via CacheMgr and store/retrieve values with getCache, put, and invalidate patterns.
  • Use cases include caching expensive computations, API results, and configuration data scoped to site or catalog.

Quick Start

Configure a caches.json for your cartridge and retrieve a cache with CacheMgr.getCache('YourCache') to store and reuse data across requests.

Frequently Asked Questions about b2c-custom-caches

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache expensive API responses in B2C Commerce?

To cache expensive API responses in B2C Commerce, define a cache ID in your cartridge's caches.json and use CacheMgr.getCache to store and retrieve the response data across requests.

How does CacheMgr work for application-level caching?

CacheMgr works by retrieving application-local caches scoped per application server. You use the getCache method to access a cache instance, then put and get methods to store and retrieve expensive data with optional expiration.

Do I need caches.json to use CacheMgr in a B2C cartridge?

Yes, you need caches.json to declare cache IDs and expiration settings within your cartridge before you can retrieve and use those caches via CacheMgr.getCache in your B2C Commerce code.

What's the best way to cache site configuration data in B2C Commerce?

The best way to cache site configuration data in B2C Commerce is defining a custom cache in caches.json and accessing it with CacheMgr to reduce repeated expensive calculations and external calls.

Can I set expiration times for custom caches in B2C Commerce?

Yes, you can set optional expiration times for custom caches in B2C Commerce by defining the expiration parameters within your cartridge's caches.json file when declaring the cache ID.

Why are my custom cache values not persisting across B2C application servers?

Custom cache values do not persist across application servers because B2C Commerce caches are scoped per application server, meaning data stored locally on one server is not shared with another.