How to set redis “session key prefix” using RedissonSessionManager
How to set redis “session key prefix” using RedissonSessionManager
I want to use "redisson-tomcat" library to store tomcat session in redis. But I need to add key prefix before storing sessions in redis. Is there any way to add session key prefix when storing sessions in redis ? As per my finding I need to configure "RedissonSessionManager" with tomcat. like bellow
<Manager className="org.redisson.tomcat.RedissonSessionManager"
configPath="$catalina.base/redisson.conf" readMode="MEMORY" updateMode="DEFAULT"/>
<Manager className="org.redisson.tomcat.RedissonSessionManager"
configPath="$catalina.base/redisson.conf" readMode="MEMORY" updateMode="DEFAULT"/>
it looks like lot of thinks can be configured using "redisson.conf" file but, I don't see any configuration to add key prefix.
Can anyone help me on this ?
2 Answers
2
It looks like redison-tomcat currently don't have this feature, as a work around I extended RedissonSessionManager
and overridden getMap
method to set custom session key prefix RedissonSessionManager::getMap. I have also send them a pull request which includes this feature. If anyone is interested your can also have a look at the pull request
RedissonSessionManager
getMap
Try to add keyprefix in your code.
<Manager className="org.redisson.tomcat.RedissonSessionManager"
configPath="$catalina.base/redisson.conf" readMode="MEMORY" updateMode="DEFAULT" keyPrefix="yourPrefix" />
this "keyPrefix" feature is my contribution, have a look at my previous comment :)
– devel83
Sep 20 '18 at 4:11
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
A good answer has a better explanation How do I write a good answer?
– Narendra Jadhav
Sep 18 '18 at 5:49