With Sails Stash, you can easily implement efficient caching for your Sails applications, enhancing performance and scalability without the need for complex setup.
Sails Stash integrates seamlessly with your Sails project, providing a straightforward way to cache data using Redis. By leveraging Redis as a caching layer, you can optimize the retrieval of frequently accessed data, reducing database load and improving overall application performance.
- Seamless integration with Sails projects
- Efficient caching using Redis
- Improved performance and scalability
- Simple setup and usage
You can install Sails Stash via npm:
npm i sails-stash
To use Redis as a cache store, install the sails-redis
adapter
npm i sails-redis
// config/datastores.js
...
cache: {
adapter: 'sails-redis'
url: '<REDIS_URL>'
}
You can now cache values in your Sails actions.
await sails.cache.fetch(
'posts',
async function () {
return await Post.find()
},
6000,
)
Check out the documentation for more ways to setup and use Sails Stash.
If you're interested in contributing to Sails Content, please read our contributing guide.
If you'd like to become a sponsor, check out DominusKelvin sponsor page and tiers.