What's the difference between saveUninitialized and resave?

前端 未结 2 520
既然无缘
既然无缘 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:01

    Basically, a session is saved in the store only when it is modified; if you add, delete or edit a session cookie (eg: req.session.test = 'some value'). If you want all the sessions to be saved in store, even if they don't have any modifications go with saveUninitialized: true.

    Now, re-saving also happens only when session variables/cookies changes. If you want to save then always go ahead with resave: true

提交回复
热议问题