DWQA QuestionsCategory: DatabaseDo session Dao and cache manager need to be set at the same time in Shiro?
Little worries asked 6 months ago

Recently, we used springboot to integrate Shiro, and redis to serve as the session cache container of Shiro. Baidu published Shiro data. Most netizens configured the cache manager and session Dao in the security manager. We checked the source code with doubts and found that the storage of Shiro’s session only needs to inherit the abstract session Dao to implement the abstract method Thank you for using the CacheManager interface here. I don’t know why it’s unnecessary to use the CacheManager!!!
clipboard.png

1 Answers
iven_wong answered 6 months ago

CacheManager is a cache manager
Sessiondao is sessiondao
The responsibilities of the two are different
Session Dao can be implemented with or without cache
For your question
If you want to save the session in redis, you can naturally implement the session Dao of redis
The CacheManager is not only used for cachingsessiondao, but also for cachingrealm