This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new af3a5900a [type:fix] fix cache too large (#4197)
af3a5900a is described below
commit af3a5900a3cb0fc11c895a0c1b669f7c1ae1c464
Author: moremind <[email protected]>
AuthorDate: Sat Nov 19 17:54:17 2022 +0800
[type:fix] fix cache too large (#4197)
* [type:fix] fix cache too large
* [type:fix] fix cache too large
---
.../org/apache/shenyu/common/cache/MemorySafeWindowTinyLFUMap.java | 3 ++-
.../src/main/java/org/apache/shenyu/common/constant/Constants.java | 5 ++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git
a/shenyu-common/src/main/java/org/apache/shenyu/common/cache/MemorySafeWindowTinyLFUMap.java
b/shenyu-common/src/main/java/org/apache/shenyu/common/cache/MemorySafeWindowTinyLFUMap.java
index aaad30c09..6c382f768 100644
---
a/shenyu-common/src/main/java/org/apache/shenyu/common/cache/MemorySafeWindowTinyLFUMap.java
+++
b/shenyu-common/src/main/java/org/apache/shenyu/common/cache/MemorySafeWindowTinyLFUMap.java
@@ -21,6 +21,7 @@ import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.apache.shenyu.common.concurrent.MemoryLimitCalculator;
import org.apache.shenyu.common.concurrent.ShenyuThreadFactory;
+import org.apache.shenyu.common.constant.Constants;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.concurrent.ThreadSafe;
@@ -56,7 +57,7 @@ public class MemorySafeWindowTinyLFUMap<K, V> extends
AbstractMap<K, V> implemen
public MemorySafeWindowTinyLFUMap(final int maxFreeMemory,
final int initialSize) {
- this(maxFreeMemory, initialSize, Long.MAX_VALUE, 1 << 30);
+ this(maxFreeMemory, initialSize, Long.MAX_VALUE,
Constants.LRU_MAP_MAXSIZE);
}
public MemorySafeWindowTinyLFUMap(final int maxFreeMemory,
diff --git
a/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
b/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
index 160c178bb..5ec980e11 100644
---
a/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
+++
b/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
@@ -647,7 +647,10 @@ public interface Constants {
*/
String DEFAULT_CLUSTER = "failover";
- int PREFIX_FORWARD_ENABLE = 1;
+ /**
+ * cache data max size, means map size.
+ */
+ Long LRU_MAP_MAXSIZE = 65536L;
/**
* String q.