MyRedisCacheManager.java 578 B

123456789101112131415161718192021
  1. package com.usky.config.shiro;
  2. import org.apache.shiro.cache.Cache;
  3. import org.apache.shiro.cache.CacheException;
  4. import org.apache.shiro.cache.CacheManager;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.data.redis.core.RedisTemplate;
  7. /**
  8. *
  9. * @author laowo
  10. */
  11. public class MyRedisCacheManager implements CacheManager {
  12. @Autowired
  13. private RedisTemplate redisTemplate;
  14. @Override
  15. public <K, V> Cache<K, V> getCache(String name) throws CacheException {
  16. return new ShiroRedisCache(name,redisTemplate);
  17. }
  18. }