|
@@ -2,6 +2,7 @@ package edu.travel.guava.cache;
|
|
|
|
|
|
import com.google.common.cache.Cache;
|
|
|
import com.google.common.cache.CacheBuilder;
|
|
|
+import com.google.common.cache.CacheLoader;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.cache.CacheManager;
|
|
@@ -24,10 +25,16 @@ public class GuavaCacheConfig {
|
|
|
.removalListener(notification -> {
|
|
|
logger.debug("Key " + notification.getKey() + " 被移除,原因: " + notification.getCause());
|
|
|
})
|
|
|
+
|
|
|
.weakKeys()
|
|
|
|
|
|
.weakValues()
|
|
|
- .recordStats().build();
|
|
|
+ .recordStats().build(new CacheLoader<String, Object>() {
|
|
|
+ @Override
|
|
|
+ public Object load(String s) throws Exception {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|