[英]How to set redis cache prefix key for non spring boot java application using xml configuration
[英]How to set redis “session key prefix” using RedissonSessionManager
我想使用“ redisson-tomcat”庫在redis中存儲tomcat會話。 但是我需要在將會話存儲在Redis中之前添加鍵前綴。 在redis中存儲會話時,有什么方法可以添加會話密鑰前綴? 根據我的發現,我需要使用tomcat配置“ RedissonSessionManager”。 像波紋管
<Manager className="org.redisson.tomcat.RedissonSessionManager" configPath="${catalina.base}/redisson.conf" readMode="MEMORY" updateMode="DEFAULT"/>
似乎可以使用“ redisson.conf”文件進行配置,但是,我看不到任何用於添加鍵前綴的配置。
誰可以幫我這個事 ?
看來redison-tomcat當前沒有此功能,因為我擴展了RedissonSessionManager
並改寫了getMap
方法來設置自定義會話密鑰前綴RedissonSessionManager :: getMap 。 我還向他們發送了包含此功能的請求請求。 如果有人感興趣,您也可以查看拉取請求
嘗試在代碼中添加keyprefix。
<Manager className="org.redisson.tomcat.RedissonSessionManager"
configPath="${catalina.base}/redisson.conf" readMode="MEMORY" updateMode="DEFAULT" keyPrefix="yourPrefix" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.