taoensso / carmine

Redis client + message queue for Clojure
https://www.taoensso.com/carmine
Eclipse Public License 1.0
1.15k stars 130 forks source link

[ring middleware] Reset session expiration on every read #261

Closed svdo closed 1 year ago

svdo commented 2 years ago

This change introduces a new option :extend-on-read? to the Ring middleware. By default it is false. When false, the session expiration will be set when it is created (and not changed afterwards) and when it is written (which normally doesn't happen when using the ring-session middleware). When true the session expiration is reset on every read, so that the session is always valid for the set number of seconds after it was last used.

Updated pull request for #259.

ptaoussanis commented 2 years ago

@svdo Thanks Stefan! Will look at merging next time I'm doing some batched work on Carmine.

Just a heads-up that this part of your understanding isn't accurate:

When false, the session expiration will be set when it is created (and not changed afterwards)

When false, the session is also renewed on any session writes (changes).

I.e. the extend-on-read? options would be:

Hope that makes sense!

svdo commented 2 years ago

Yes I understand, thanks for clarifying!!

ptaoussanis commented 1 year ago

@svdo Will be merged in next release, thanks Stefan! Apologies for the long delay.

svdo commented 1 year ago

No problem at all @ptaoussanis, I've been using my fork so that didn't cause any issues for me :)