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

Configurable Tomcat Session Key Prefix for Redis #1321

Merged
merged 3 commits into from Mar 6, 2018

Conversation

faisalbegins
Copy link

@faisalbegins faisalbegins commented Mar 2, 2018

Currently there is no way to customise tomcat session key for redis, which is always "redisson_tomcat_session:" + sessionId.

But in environment where multiple tomcat instances are using same redis cluster in it not possible to distinguish different tomcat instances.

In this pull request I have added configuration option for tomcat session key prefix, while configuring session manager use following configuration to customise tomcat session key prefix.

<Manager className="org.redisson.tomcat.RedissonSessionManager" configPath="${catalina.base}/redisson.conf" readMode="MEMORY" updateMode="DEFAULT" keyPrefix="this_is_a_test_prefix"/>

this will allow redisson to store tomcat session keys using following keys

this_is_a_test_prefix:redisson_tomcat_session:E61653A9FEE61CB5D0967C2C40451363

@mrniko
Copy link
Member

mrniko commented Mar 5, 2018

Hi! Thank you for your contribution. Could you change keySpace to keyPrefix?

@mrniko mrniko modified the milestones: 2.11.2, 2.11.3 Mar 5, 2018
@faisalbegins
Copy link
Author

@mrniko I've updated "keySpace" to "keyPrefix".

@mrniko mrniko merged commit 6cae205 into redisson:master Mar 6, 2018
@mrniko
Copy link
Member

mrniko commented Mar 6, 2018

Thanks for contribution!

@hanschua
Copy link

hanschua commented Mar 8, 2018

@devel83 the implementation seems to be missing a colon

The example will result to this_is_a_test_prefixredisson_tomcat_session:E61653A9FEE61CB5D0967C2C40451363

@mrniko
Copy link
Member

mrniko commented Mar 8, 2018

#1321 (comment)

@devel83 could you please fix it ?

@faisalbegins
Copy link
Author

@mrniko @hans123456 I opt out colon intentionally. I was thinking users will put colon themselves, but looks like that was a wrong idea. I will add colon.

@faisalbegins
Copy link
Author

faisalbegins commented Mar 12, 2018

@mrniko created a pull request for this fix (#1336)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants