简体   繁体   English

express-session:捆绑存储库中的替代方法

[英]express-session: alternatives over bundled memorystore

I am looking at implementing express-session into my application and need to make a choice over what session to store to use in place of the bundled memorystore that comes with this library. 我正在考虑在我的应用程序中实现快速会话,并且需要选择要存储的会话来代替此库随附的捆绑内存存储。

I understand the limitations of using memorystore in a production environment, I have seen there are other more stable memory stores such as memcache, which I think I read somewhere can survive app restarts keeping users logged in - have I got that right? 我了解在生产环境中使用内存存储的局限性,我已经看到了其他更稳定的内存存储,例如memcache,我认为我在某个地方可以读取到可以在应用重新启动后保持用户登录状态的内容-我说得对吗?

Is there any memory store implementation that can be used in a production environment, or is it advisable to steer clear and go for a proper db store such as mongoDB? 是否有任何可以在生产环境中使用的内存存储实现,还是建议您清除并选择合适的数据库存储(例如mongoDB)?

I am trying to minimise the learning curve as much as possible for others in my team and reduce the setup and maintenance overhead for production, which having a separate db store could well bring. 我正在尝试尽可能减少团队中其他成员的学习曲线,并减少生产的设置和维护开销,而拥有单独的数据库存储可能会带来很多好处。

Mongo could be ok, but it might choke under load. Mongo可能还可以,但在负载下可能会窒息。 YMMV. YMMV。

Redis is a better bet imho. Redis是更好的选择,恕我直言。 See https://github.com/tj/connect-redis for example. 例如,请参见https://github.com/tj/connect-redis

Look here for a complete tutorial using connect-redis 在此处查找使用connect-redis的完整教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM