我正在学习 ExpressJS,我想制作一个注册登录系统。
我正在阅读有关 express-session 的内容,它似乎易于使用,但我想知道,默认情况下,它在哪里为每个用户存储 session ?什么时候删除这些 session ?
你们能给我一些关于这个的博客文章吗?感谢你
最佳答案
如果您不为 express-session 提供存储机制,那么它只会使用轻量级内存存储。因此,它不会在服务器重新启动后持续存在。
来自 the doc :
store
The session store instance, defaults to a new MemoryStore instance.
MemoryStore
带有这些警告:Warning The default server-side session storage, MemoryStore, is purposely not designed for a production environment. It will leak memory under most conditions, does not scale past a single process, and is meant for debugging and developing.
For a list of stores, see compatible session stores.
关于node.js - session 存储在哪里? (ExpressJS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48180460/