alexedwards / scs

HTTP Session Management for Go
MIT License
2.13k stars 166 forks source link

Compare to Gorilla Session #26

Closed amkgo closed 6 years ago

amkgo commented 6 years ago

I'm new to Go session management. How does this compare to Gorilla Session?

Thanks, Andrew

jpfluger commented 6 years ago

gorilla/sessions is an actively supported repo that has been around a while, having it's first commit way back on Oct 2, 2012. For many applications, gorilla/sessions has been great but it has begun to show its age. There's plans for a gorilla/sessions v2.0.

The past couple days I tested gorilla/sessions and scs. So far I'm really liking scs over gorilla/sessions for three reasons.

  1. I didn't want to fight the gorilla/session's v1 context bug and don't want to wait for a fix in v2. gorilla/sessions does not use the default Go context package but rather depends on gorilla/context. scs uses the native Go context package, which was made part of the standard library in v1.7.0. The newer go context lib doesn't play nice with the older gorilla/context. An excellent explanation can be found on StackOverflow.
  2. gorilla/sessions updates the sessionid of client-cookies unnecessarily. By default, scs does not update the sessionid but still gives me the option to Renew.
  3. I like the scs option of builtin stores. The store interface is simple to extend to other data sources.
alexedwards commented 6 years ago

@jpfluger Thanks for writing the (accurate and helpful) response 👍