connect-couchbase
connect-couchbase copied to clipboard
Touch
Hello,
I had a strange behaviour on session expire
. I am using resave: false
in expression-session because as mentioned in there repository:
The default value is true, but using the default has been deprecated, as the default will change in the future. Please research into this setting and choose what is appropriate to your use-case. Typically, you'll want false.
ref: https://github.com/expressjs/session/blob/master/README.md#resave
I have added a lastModified
to check against the ttl
param. The expires
will be updated as long as the session is alive, and when it expires, a new session is created.
I attached the message I was getting before my update.
Regards, Martin-Luther
Hi Martin-Luther,
I have incorporated your changes for the re-use of an existing DB connection, but I have not merged in the updates for TOUCH vs Resave. Based on your concern, I don't see how the two are related or what exactly is being accomplished, and with the frequency that touch is called, I'd prefer to keep the client.touch vs client.upsert.
If you can explain a bit more why the TTL is not enough, that would be good. The way I see it, so long as the TTL is set properly on the couchbase item, it should expire as expected and when pulling it from the DB you'll get no record back, and thus express will end up creating a new session. Maybe I'm misunderstanding what you're trying to accomplish?
Thanks.