Skip to content

WARNING

You're looking at the old Rest Cache plugin documentation for Strapi v4. Documentation for Strapi v5 can be found here.

Memory provider

The memory provider allow you to store cached content in memory. It use a simple key-value store with LRU algorithm provided by the default provider of node-cache-manager module which uses lru-node.

Installation

INFO

This provider is already installed with the plugin.

Configuration

js
// file: /config/plugins.js

module.exports = ({ env }) => ({
  'rest-cache': {
    config: {
      provider: {
        name: 'memory',
        getTimeout: 500,
        options: {
          // The maximum size of the cache
          max: 32767,
          // Update to the current time whenever it is retrieved from cache, causing it to not expire
          updateAgeOnGet: false,
          // ...
        },
      },
      strategy: {
        // ...
      },
    },
  },
});

TIP

View full options available on lru-cache documentation.