-
Notifications
You must be signed in to change notification settings - Fork 682
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 it possible to change session store implementation #1180
Conversation
…SessionStore This will allow adding of other session stores, e.g. cache or database.
… parameter. CookieSessionStore is the default.
@xael-fry I think the change is good. Recommended to merge. |
framework/src/play/mvc/Scope.java
Outdated
public static SessionStore sessionStore = createSessionStore(); | ||
|
||
private static SessionStore createSessionStore() { | ||
String sessionStoreParameter = Play.configuration.getProperty("application.session.store", "cookie"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better if we just have application.session.storeClass which takes in the class instead of relying on some naming convention that has a "SessionStore" suffix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theo @angryziber @cbxp I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the simpler parameter is more consistent with other parameters, e.g. memcached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the simpler parameter is more consistent with other parameters, e.g. memcached
…naming conventions
I have made the requested change. How about a merge? |
Note: build actually passed. For some reason it status was not updated here |
@asolntsev Maybe documentation of |
@xael-fry Good catch. I will add it to the documentation. |
Should the name be |
It seems unlikely that there will be more general store parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There are some problems with the default cookie-based sessions, including:
This PR makes it possible to implement other backends for session storage, e.g. cache or database.
This is similar to CacheImpl, where new caching implementaions can be created.
The default implementation is CookieSessionStore that extracted as-is from Scope.Session class. All Scope.Session API is left 100% unchanged, so no breaking changes.
No new implementations are provided as of now, but we can create a separate PR with cache-based implementation.