mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 12:18:42 +08:00 
			
		
		
		
	Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleController.java
This commit is contained in:
		@@ -15,6 +15,7 @@ import java.util.Arrays;
 | 
			
		||||
@Getter
 | 
			
		||||
public enum TerminalEnum implements IntArrayValuable {
 | 
			
		||||
 | 
			
		||||
    UNKNOWN(0, "未知"), // 目的:在无法解析到 terminal 时,使用它
 | 
			
		||||
    WECHAT_MINI_PROGRAM(10, "微信小程序"),
 | 
			
		||||
    WECHAT_WAP(11, "微信公众号"),
 | 
			
		||||
    H5(20, "H5 网页"),
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,12 @@
 | 
			
		||||
package cn.iocoder.yudao.framework.common.util.cache;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.ttl.threadpool.TtlExecutors;
 | 
			
		||||
import com.google.common.cache.CacheBuilder;
 | 
			
		||||
import com.google.common.cache.CacheLoader;
 | 
			
		||||
import com.google.common.cache.LoadingCache;
 | 
			
		||||
 | 
			
		||||
import java.time.Duration;
 | 
			
		||||
import java.util.concurrent.Executor;
 | 
			
		||||
import java.util.concurrent.Executors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -15,11 +17,13 @@ import java.util.concurrent.Executors;
 | 
			
		||||
public class CacheUtils {
 | 
			
		||||
 | 
			
		||||
    public static <K, V> LoadingCache<K, V> buildAsyncReloadingCache(Duration duration, CacheLoader<K, V> loader) {
 | 
			
		||||
        Executor executor = Executors.newCachedThreadPool(  // TODO 芋艿:可能要思考下,未来要不要做成可配置
 | 
			
		||||
                TtlExecutors.getDefaultDisableInheritableThreadFactory()); // TTL 保证 ThreadLocal 可以透传
 | 
			
		||||
        return CacheBuilder.newBuilder()
 | 
			
		||||
                // 只阻塞当前数据加载线程,其他线程返回旧值
 | 
			
		||||
                .refreshAfterWrite(duration)
 | 
			
		||||
                // 通过 asyncReloading 实现全异步加载,包括 refreshAfterWrite 被阻塞的加载线程
 | 
			
		||||
                .build(CacheLoader.asyncReloading(loader, Executors.newCachedThreadPool())); // TODO 芋艿:可能要思考下,未来要不要做成可配置
 | 
			
		||||
                .build(CacheLoader.asyncReloading(loader, executor));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -88,8 +88,6 @@ public class ServletUtils {
 | 
			
		||||
        return JakartaServletUtil.getClientIP(request);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO @疯狂:terminal 还是从 ServletUtils 里拿,更容易全局治理;
 | 
			
		||||
 | 
			
		||||
    public static boolean isJsonRequest(ServletRequest request) {
 | 
			
		||||
        return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user