Skip to content

Commit

Permalink
Merge pull request #3403 from KouShenhai/dev
Browse files Browse the repository at this point in the history
fix: SQL缓存,拼接多个租户ID
  • Loading branch information
KouShenhai authored Jan 22, 2025
2 parents d17e6a8 + ae5532c commit 2a37635
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import net.sf.jsqlparser.expression.Function;
import net.sf.jsqlparser.statement.select.OrderByElement;
import org.apache.fury.Fury;
import org.apache.fury.ThreadLocalFury;
import org.apache.fury.ThreadSafeFury;

/**
* @author laokou
Expand All @@ -29,7 +29,7 @@ public final class FuryFactory {

private static final FuryFactory FACTORY = new FuryFactory();

private final ThreadLocalFury FURY = Fury.builder().buildThreadLocalFury();
private final ThreadSafeFury FURY = Fury.builder().buildThreadSafeFury();

public FuryFactory() {
FURY.register(net.sf.jsqlparser.expression.Alias.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import com.baomidou.mybatisplus.extension.parser.cache.AbstractCaffeineJsqlParseCache;
import com.github.benmanes.caffeine.cache.Cache;

import java.util.concurrent.Executor;

/**
* jsqlparser 缓存 fury 序列化 Caffeine 缓存实现.
*
Expand All @@ -33,13 +31,6 @@ public FurySerialCaffeineJsqlParseCache(Cache<String, byte[]> cache) {
super(cache);
}

public FurySerialCaffeineJsqlParseCache(Cache<String, byte[]> cache, Executor executor, boolean async) {
super(cache);
super.executor = executor;
// 开启异步
super.async = async;
}

@Override
public byte[] serialize(Object obj) {
return FuryFactory.getFuryFactory().serialize(obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public class MybatisPlusAutoConfig {

static {
JsqlParserGlobal.setJsqlParseCache(new FurySerialCaffeineJsqlParseCache(
Caffeine.newBuilder().maximumSize(4096).expireAfterWrite(10, TimeUnit.MINUTES).build(),
ThreadUtil.newVirtualTaskExecutor(), true));
Caffeine.newBuilder().maximumSize(4096).expireAfterWrite(10, TimeUnit.MINUTES).build()));
}

@Bean
Expand Down

0 comments on commit 2a37635

Please sign in to comment.