Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make SkinnySession storage pluggable #276

Open
DanielJoyce opened this issue Jul 20, 2015 · 7 comments
Open

make SkinnySession storage pluggable #276

DanielJoyce opened this issue Jul 20, 2015 · 7 comments

Comments

@DanielJoyce
Copy link

Right now SkinnySession relies on jdbc for persistence. If you want 'immediately' consistent sessions, this requires a db read and or write for each request, for every page using it. Lots of overhead!

It would be nice if SkinnySession was broken apart to provide a pluggable API so I could have a memcached backend, a mongo/redis/etc backed, etc.

For my own project, I plan on refactoring SkinnyFilter and SkinnySession.

@seratch
Copy link
Member

seratch commented Jul 20, 2015

Right now, only JDBC implementation is provided but it would be nce to add other backend implementations and switch what to use by specifying it in application.conf (e.g.) skinny.session.backend=memcacched.

skinny.session.jdbc.* things are hidden by skinny.session.SkinnyHttpSession. Just adding new back implementation and adding the above application.conf setting and reading it will be needed.

@seratch seratch added this to the 2.0.x milestone Jul 20, 2015
@DanielJoyce
Copy link
Author

Seems weird you have to explicitly use skinnySession in your controllers. Since we have ServletContext and even low level access to the servlet sessions, can't we simply just swap out the default session handling with a new one?

@seratch
Copy link
Member

seratch commented Jul 20, 2015

If there was a library which provides stable and mostly compatible HttpSession replacement, using it in Skinny apps would be simpler. If you or someone is going to create such a thing, it won't depend on Skinny stack but just Servlet APIs.

@DanielJoyce
Copy link
Author

It would seem this would be the best hook as opposed to a special session manager.

https://wiki.eclipse.org/Jetty/Howto/Persisting_Sessions

Here, instead of HashSessionManager, we'd create a "MemcacheSessionManager" or whatever, and hook into Jetty.

@DanielJoyce
Copy link
Author

    ctx.asInstanceOf[org.eclipse.jetty.webapp.WebAppContext].setSessionHandler(mySessionHandler)

I think

Of course, this would only support Jetty. Each webapp server would need its own session handler. I know this is possible because TerraCota offered a distributed session cache for tomcat 6 years ago or so, which provides a similar api...

@DanielJoyce
Copy link
Author

@seratch seratch removed this from the 2.0.x milestone May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants