baolei před 2 měsíci
rodič
revize
6d89821374

+ 8 - 2
08.src/Xingxi/xingxi-framework/src/main/java/com/xingxi/framework/shiro/service/SysPasswordService.java

@@ -2,6 +2,8 @@ package com.xingxi.framework.shiro.service;
 
 import java.util.concurrent.atomic.AtomicInteger;
 import javax.annotation.PostConstruct;
+
+import com.xingxi.common.core.redis.RedisCache;
 import org.apache.shiro.cache.Cache;
 import org.apache.shiro.cache.CacheManager;
 import org.apache.shiro.crypto.hash.Md5Hash;
@@ -25,8 +27,10 @@ import com.xingxi.framework.manager.factory.AsyncFactory;
 @Component
 public class SysPasswordService
 {
+//    @Autowired
+//    private CacheManager cacheManager;
     @Autowired
-    private CacheManager cacheManager;
+    private RedisCache redisCache;
 
     private Cache<String, AtomicInteger> loginRecordCache;
 
@@ -36,7 +40,9 @@ public class SysPasswordService
     @PostConstruct
     public void init()
     {
-        loginRecordCache = cacheManager.getCache(ShiroConstants.LOGIN_RECORD_CACHE);
+//        loginRecordCache = cacheManager.getCache(ShiroConstants.LOGIN_RECORD_CACHE);
+        loginRecordCache = redisCache.getCacheObject(ShiroConstants.LOGIN_RECORD_CACHE);
+        redisCache.expire(ShiroConstants.LOGIN_RECORD_CACHE, 60 * 5);
     }
 
     public void validate(SysUser user, String password)