diff --git a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CCache.java b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CCache.java
index 4b63720..ebcb339 100644
--- a/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CCache.java
+++ b/platform-legacy-core/src/main/java/com/dsasp/server/common/dataDic/bean/CCache.java
@@ -1,26 +1,51 @@
package com.dsasp.server.common.dataDic.bean;
import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
+
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
/**
* eip4-poc 移植替换类:原版为 Adempiere CCache(HashMap + 过期 + CacheMgt 全局注册,
- * GPL-2 头)。移植代码只使用其 Map API(get/put/containsKey),故重写为最小实现,
- * 去除 CacheInterface/CacheMgt 依赖与 GPL 来源代码。构造器签名保持兼容。
+ * GPL-2 头)。移植代码只使用其 Map API(get/put/remove/size/clear)与构造器/getName/reset。
+ *
+ *
P1-4 加固:内部实现由「极简 HashMap 版」改为 Caffeine(语义=进程内本地缓存,
+ * 接替 CCache 的语义保持不变)。公共签名一行不动——仍 {@code extends HashMap}、
+ * 两个构造器、{@code getName}/{@code reset} 原样,故 {@code s_cache.get/put/remove} 等
+ * 调用点零改动。HashMap 父类不再承载数据,所有读写经下方 Caffeine {@link #delegate} 代理。
+ *
+ *
容量/过期默认值给合理缺省:默认无过期(元数据缓存语义,靠失效钩子 {@code reset/remove}
+ * 主动失效,与原 PoC 行为一致);当构造器显式传 {@code expireMinutes>0} 时启用写后过期。
+ * {@code maximumSize} 取构造入参 {@code initialCapacity} 与下限 256 的较大值,避免过小驱逐。
+ *
+ *
架构第三节留口:多实例横扩时「走 Spring Cache 抽象换 Redis」。CCache 的公共签名
+ * ({@code extends HashMap} + 静态字段直引)锁死了无法在不破坏签名前提下套 Spring Cache
+ * 抽象,故此处为 Caffeine 直用;与该条款的差距及后续路径见 P1加固实测报告。
*/
public class CCache extends HashMap {
private static final long serialVersionUID = 1L;
+ private static final int MIN_MAX_SIZE = 256;
+
private final String name;
+ private final transient Cache delegate;
+
public CCache(String name, int initialCapacity) {
- super(initialCapacity);
- this.name = name;
+ this(name, initialCapacity, 0);
}
public CCache(String name, int initialCapacity, int expireMinutes) {
- this(name, initialCapacity);
- // PoC:元数据缓存不做过期;如需失效调用 reset()
+ super(1);
+ this.name = name;
+ long maxSize = Math.max(initialCapacity, MIN_MAX_SIZE);
+ Caffeine