Caching strategies
Learn about the available caching strategies in Front-Commerce.
Redis
The Redis
implementation allows to cache data in a redis server.
It uses node's ioredis
package as a redis
client. Please refer to the package documentation for
all the available options.
Here is a full configuration example:
app/config/caching.js
export default {
strategies: [
{
implementation: "Redis",
supports: "*",
config: {
// See https://www.npmjs.com/package/redis#options-object-properties
host:
process.env.FRONT_COMMERCE_CLOUD_REDIS_HOST || // Front-Commerce Cloud variables
process.env.FRONT_COMMERCE_REDIS_HOST || // default variables
"127.0.0.1", // default value (localhost)
port:
process.env.FRONT_COMMERCE_CLOUD_REDIS_PORT ||
process.env.FRONT_COMMERCE_REDIS_PORT ||
6379,
db:
process.env.FRONT_COMMERCE_CLOUD_REDIS_DB ||
process.env.FRONT_COMMERCE_REDIS_DB ||
0,
// Front-Commerce options
// defaultExpireInSeconds: 82800, // default: 23 hours
// invalidationScanIterationSize: 2000, // default: 1000
},
},
],
};