https://github.com/eggjs/session-redis
redis store for egg session
https://github.com/eggjs/session-redis
egg egg-plugin redis session
Last synced: 3 months ago
JSON representation
redis store for egg session
- Host: GitHub
- URL: https://github.com/eggjs/session-redis
- Owner: eggjs
- License: mit
- Created: 2017-03-01T02:48:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-10T04:32:28.000Z (almost 7 years ago)
- Last Synced: 2024-10-29T21:05:54.574Z (8 months ago)
- Topics: egg, egg-plugin, redis, session
- Language: JavaScript
- Size: 12.7 KB
- Stars: 44
- Watchers: 12
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
- awesome-egg - egg-session-redis - redis store for egg session   (仓库 / 插件)
- awesome-egg - egg-session-redis - redis store for egg session (Plugins)
README
# @eggjs/session-redis
[![NPM version][npm-image]][npm-url]
[](https://github.com/eggjs/session-redis/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[](https://nodejs.org/en/download/)
[](https://makeapullrequest.com)
[npm-image]: https://img.shields.io/npm/v/@eggjs/session-redis.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@eggjs/session-redis
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/session-redis.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/session-redis?branch=master
[snyk-image]: https://snyk.io/test/npm/@eggjs/session-redis/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@eggjs/session-redis
[download-image]: https://img.shields.io/npm/dm/@eggjs/session-redis.svg?style=flat-square
[download-url]: https://npmjs.org/package/@eggjs/session-redisA session extension for store session in redis.
## Install
```bash
npm i @eggjs/session-redis @eggjs/redis
```## Usage
This module dependent on [@eggjs/redis](https://github.com/eggjs/redis) plugin, so we must enable both.
```js
// {app_root}/config/plugin.js
exports.sessionRedis = {
enable: true,
package: '@eggjs/session-redis',
};exports.redis = {
enable: true,
package: '@eggjs/redis',
};
```## Configuration
If we only have one redis instance:
```js
// {app_root}/config/config.default.js
exports.redis = {
client: {
host: 'your redis host',
port: 'your redis port',
password: '',
db: '0',
},
agent:true
};
// no need to set any sessionRedis config
```If we have more than one redis instance, we need to configure which instance to be used as session store.
```js
// {app_root}/config/config.default.jsexports.redis = {
clients: {
session: { /* config */ },
cache: { /* config */ },
},
};exports.sessionRedis = {
name: 'session', // specific instance `session` as the session store
};
```## Questions & Suggestions
Please open an issue [here](https://github.com/eggjs/egg/issues).
## License
[MIT](LICENSE)
## Contributors
[](https://github.com/eggjs/session-redis/graphs/contributors)
Made with [contributors-img](https://contrib.rocks).