Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/next-boost/redis-cache
This is the cache plugin for running next-boost on a cluster
https://github.com/next-boost/redis-cache
cache next-boost redis swr
Last synced: about 2 months ago
JSON representation
This is the cache plugin for running next-boost on a cluster
- Host: GitHub
- URL: https://github.com/next-boost/redis-cache
- Owner: next-boost
- Created: 2021-12-07T03:11:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-08T04:25:52.000Z (almost 3 years ago)
- Last Synced: 2024-09-21T11:41:39.447Z (4 months ago)
- Topics: cache, next-boost, redis, swr
- Language: TypeScript
- Homepage:
- Size: 119 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Coverage Status](https://coveralls.io/repos/github/next-boost/redis-cache/badge.svg?branch=main)](https://coveralls.io/github/next-boost/redis-cache?branch=main) [![Maintainability](https://api.codeclimate.com/v1/badges/853b19631069cf943e89/maintainability)](https://codeclimate.com/github/next-boost/redis-cache/maintainability)
# redis-cache
A redis-based cache for next-boost. If you have a cluster of next-boost running, using this plugin to share the cache between instances.
```bash
npm i @next-boost/redis-cache
```## Usage
```javascript
// in .next-boost.js
const RedisCache = require('@next-boost/redis-cache/dist/adapter').defaultmodule.exports = {
cacheAdapter: RedisCache.init({
uri: 'redis:///',
ttl: 15,
tbd: 3600,
}),
rules: [
...
],
}
```## Passing your own Redis Client
You can also provide an [ioredis](https://github.com/luin/ioredis) client or or cluster instance if you need advanced configuration
```javascript
cacheAdapter: RedisCache.init({
redis: new Redis.Cluster({...}),
ttl: 15,
tbd: 3600,
})
```## License
MIT. Copyright 2020, Rakuraku Jyo.