What's the difference between saveUninitialized and resave?

前端 未结 2 521
既然无缘
既然无缘 2020-12-31 06:15

The session middleware for Express provides several configurable options.

resave: \'Forces the session to be saved back to the session store, even i

2条回答
  •  执念已碎
    2020-12-31 07:20

    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.

    From this I understand the difference is:

    (Unmodified 'state' is different to uninitialized state)

    resave: For any request made

    • Nothing in the session needs to change (no login etc).
    • Change of session required (logged in)

    "Forces session to be saved even when unmodified"

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

    • Not modified only, nothing in the session needs to change (no login etc).

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

提交回复
热议问题