connect-redis
Advanced tools
Comparing version
{ | ||
"name": "connect-redis", | ||
"description": "Redis session store for Connect", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -49,2 +49,5 @@ "contributors": [ | ||
}, | ||
"peerDependencies": { | ||
"express-session": ">=1" | ||
}, | ||
"engines": { | ||
@@ -51,0 +54,0 @@ "node": ">=16" |
@@ -127,27 +127,3 @@  [](https://npmjs.com/package/connect-redis) [](https://gitter.im/jlongster/prettier)  | ||
## FAQ | ||
#### How to log Redis errors? | ||
```js | ||
client.on("error", console.error) | ||
``` | ||
#### How do I handle lost connections to Redis? | ||
By default, the Redis client will [auto-reconnect](https://github.com/mranney/node_redis#overloading) on lost connections. But requests may come in during that time. In Express, one way you can handle this scenario is including a "session check": | ||
```js | ||
app.use(session(/* setup session here */)) | ||
app.use(function (req, res, next) { | ||
if (!req.session) { | ||
return next(new Error("oh no")) // handle error | ||
} | ||
next() // otherwise continue | ||
}) | ||
``` | ||
If you want to retry, here is [another option](https://github.com/expressjs/session/issues/99#issuecomment-63853989). | ||
[1]: https://github.com/NodeRedis/node-redis | ||
[2]: https://github.com/luin/ioredis |
42824
-1.48%1
Infinity%129
-15.69%