# koa-redis-session

> Simple redis session store for `koa-session`

Latest version **1.0.1** (published 2018-02-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-redis-session
pnpm add koa-redis-session
yarn add koa-redis-session
bun add koa-redis-session
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-02-01 |
| First published | 2018-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ben |
| Maintainers | benhuang |
| Keywords | koa-session, redis, store, koa, session |

## Links

- npm: https://www.npmjs.com/package/koa-redis-session
- npm.io page: https://npm.io/package/koa-redis-session

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-02-01
- 1.0.0 — 2018-02-01

## README

Simple redis sessioin store for [koa-sessioin](https://github.com/koajs/session).

```javascript
const session = require("koa-session");
const redisStore = require("koa-redis-session");
const Koa = require("koa");
const app = new Koa();

app.keys = ["some secret hurr"];
app.use(session({
    key: 'koa:sess',
    maxAge: 86400000,

    store: new redisStore({
        port: 6379,          // Redis port
        host: '127.0.0.1',   // Redis host
        family: 4,           // 4 (IPv4) or 6 (IPv6)
        password: 'auth',
        db: 0,
        // ... And more options you can use in ioredis 
        // See: https://github.com/luin/ioredis/blob/HEAD/API.md#new_Redis

        onError: (e) => console.log(e), // Optional. it will be called when redis client emits an error event.
    }),
}, app));
```

# Why Use?

When you use `koa-session` without external session stores, the session is stored in a cookie by default. It has some disadvantages:

- Session is stored on client side unencrypted
- Browser cookies always have length limits

If you every care about one of the above in your project, you should use an external session store.

In addition, when you use external stores, session storage is dependent on your external store -- you can't access the session if your external store is down. Use external session stores only if necessary.

refer: https://github.com/koajs/session

---
_Source: https://npm.io/package/koa-redis-session · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
