فهرست منبع

修改密保后清除缓存

wangmh 7 سال پیش
والد
کامیت
9fefcd753a

+ 2 - 1
sso-server/src/main/java/com/uas/sso/service/impl/UserServiceImpl.java

@@ -20,6 +20,7 @@ import com.uas.sso.util.AccountTypeUtils;
 import com.uas.sso.util.ExecuteUtils;
 import com.uas.sso.util.PasswordLevelUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.domain.Page;
@@ -460,7 +461,7 @@ public class UserServiceImpl implements UserService {
     }
 
     @Override
-    @CachePut(value = "UserCache", key = "'user:' + #userUU")
+    @CacheEvict(value = "UserCache", key = "'user:' + #userUU")
     public void setQuestion(Long userUU, List<UserQuestion> questions) {
         // 找到用户密保
         User user = userDao.findOne(userUU);

+ 4 - 4
sso-server/src/main/resources/spring/ehcache.xml

@@ -19,14 +19,14 @@
     <!-- User对象缓存 -->
     <cache name="UserCache"
            maxElementsInMemory="10000" eternal="false" overflowToDisk="false"
-           memoryStoreEvictionPolicy="LFU" timeToIdleSeconds="604800"
-           timeToLiveSeconds="604800" />
+           memoryStoreEvictionPolicy="LFU" timeToIdleSeconds="86400"
+           timeToLiveSeconds="86400" />
 
     <!-- UserSpace对象缓存 -->
     <cache name="UserSpaceCache"
            maxElementsInMemory="10000" eternal="false" overflowToDisk="false"
-           memoryStoreEvictionPolicy="LFU" timeToIdleSeconds="604800"
-           timeToLiveSeconds="604800" />
+           memoryStoreEvictionPolicy="LFU" timeToIdleSeconds="86400"
+           timeToLiveSeconds="86400" />
 
     <!-- 消息服务配置缓存 -->
     <cache name="setting"