会话存储的用途是什么? [英] What is the use of a session store?

查看:108
本文介绍了会话存储的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用koa和护照,因此我在使用 koa-generic-session 中间件处理我的会议.

I am using koa and passport therefore I am using the koa-generic-session middleware to handle my sessions.

现在,与expressjs session 中间件不同,在文档中并没有很大的免责声明,例如: 默认的服务器端会话存储MemoryStore并非专门用于生产环境.

Now unlike the expressjs session middleware there isn't a big disclaimer in the documentation like such : The default server-side session storage, MemoryStore, is purposely not designed for a production environment.

假定用于koa通用会话的MemoryStore已准备好用于生产,为什么我要为一整天来来往往的会话使用诸如mysql或mongodb之类的重型会话存储?使用某项功能还有哪些其他功能会给我带来MemoryStore无法提供的功能?

Assuming the MemoryStore for the koa-generic-session is ready for production use, why would I use a heavy duty session store such as mysql or mongodb for sessions that come and go all day long? What additional capabilities would using one give me that MemoryStore doesn't?

推荐答案

在内存会话中,存储非常适合开发,但是有一些用于生产的腔体.

In memory session store works perfectly for development but it has a couple of caviats for production use.

  • 重新启动服务器会导致所有会话均无效,这对于您的应用程序用户而言不是很好
  • 内存存储中的
  • 不能有效地处理可能同时进行大量会话的生产级负载,因此,更有效的存储更好,它可以写入磁盘,经常使用的缓存.数据库将满足所有这些素质

这篇关于会话存储的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆