A question about express-session

What is the function of the resave attribute in

express-session? the official document is translated literally in this way

< hr >

: force session to be saved to session store. Even if the session is not modified in the request. But this is not necessarily necessary if the client has

     sessionsesion 
     true,defaultfalse 
    storeresavestoretouch(sessionsession storesession          )resave:false,touchstoresessionresave:true 


< hr >

my understanding is that a client has two requests. The first request modifies the session and the second does not change, so the first modified session is overwritten and the result is that the session is not modified.

May.22,2021

concurrent requests can lead to session inconsistencies, because when the resave option is set to true (by default, true), executes req.session.save, every time you call the res.send method to send a response, so no matter whether these two requests are modified or not, the value in the store of the last default storage session of session, will be the last value of session in the request that executes the res.send method, that is, the slowest response.

reference link

Menu