Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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').default

module.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.