fix: 咖啡因修复
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
package com.schisandra.oss.common.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.benmanes.caffeine.cache.Cache;
|
||||||
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Setter
|
||||||
|
@Slf4j
|
||||||
|
public class CaffeineUtil {
|
||||||
|
|
||||||
|
public static int maximumSize=10000;
|
||||||
|
public static int expiresTime = 3;
|
||||||
|
public static TimeUnit unitTime = TimeUnit.MINUTES;
|
||||||
|
// @Bean
|
||||||
|
public Cache<String,String> caffeineUtil(){
|
||||||
|
Cache<String, String> cache = Caffeine.newBuilder()
|
||||||
|
.maximumSize(maximumSize)
|
||||||
|
.expireAfterWrite(expiresTime, unitTime)
|
||||||
|
.build();
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user