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" />






A good answer has a better explanation How do I write a good answer?

– Narendra Jadhav
Sep 18 '18 at 5:49






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

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)