Skip to content

Redis

Install adapter

To setup Sails Stash to use Redis as the cache store, install the sails-redis Waterline adapter:

sh
npm i sails-redis

Setup datastore

Next, setup the datastore for your cache in config/datastores.js:

js
module.exports.datastores = {
  default: {}
  cache: {
    adapter: 'sails-redis',
    url: 'redis://localhost:6379'
  }
}

That's it, your Sails app is now ready to use Redis for caching 🥳.

TIP

In production, do make sure to replace the url to Redis with an environment variable like process.env.REDIS_CACHE_URL

All open source projects are released under the MIT License.