saveUninitialized和resave有什么区别? [英] What's the difference between saveUninitialized and resave?

查看:33
本文介绍了saveUninitialized和resave有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Express会话中间件提供多个可配置选项.

The session middleware for Express provides several configurable options.

重新保存:即使未在请求期间修改会话,也强制将会话保存回会话存储."

resave: 'Forces the session to be saved back to the session store, even if the session was never modified during the request.'

saveUninitialized :强制将未初始化"的会话保存到商店.会话是新会话但未修改时未初始化.'

saveUninitialized: 'Forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified.'

这两个选项似乎都用于保存未修改的会话.有什么区别?

It appears that both options are for saving unmodified sessions. What's the difference?

推荐答案

我以为我会从一个基本的答案入手,这是我到目前为止的一点理解,并将一起加以改进.重要的问题死"了太久了.

I thought I would start off with a basic answer, my bit of understanding so far, and improve it together. Important question been 'dead' for too long.

来自,我知道区别是:

(未修改的状态"与未初始化的状态不同)

(Unmodified 'state' is different to uninitialized state)

保存:对于任何请求

  • 会话中的任何内容都不需要更改(无需登录等).
  • 需要更改会话(已登录)

即使未进行修改也强制保存会话"

"Forces session to be saved even when unmodified"

saveUninitialized :关于会话的状态(如果会话仍处于未初始化状态).

saveUninitialized: Is about the state of the session, if its still in the uninitialized state.

  • 不仅被修改,会话中的任何内容都无需更改(无需登录等).

强制将未初始化"的会话保存到存储中.新创建但未修改的会话未初始化."

"Forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified."

这篇关于saveUninitialized和resave有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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