Skip to content

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 quick-lru.

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 time to live in milliseconds. This is the maximum amount of time that an item can be in the cache before it is removed.
          ttl: 3600 * 1000
          // The maximum number of items before evicting the least recently used items.
          maxSize: 32767
          // ...
        },
      },
      strategy: {
        // ...
      },
    },
  },
});

TIP

Additionally you can add options specifically for this provider. For all the options see quick-lru documentation.