CachedEntry

This commit is contained in:
redkale
2024-11-05 16:09:59 +08:00
parent da25cd531f
commit 39b1ea3e4e
2 changed files with 12 additions and 6 deletions

View File

@@ -178,7 +178,11 @@ public class CachedAsmMethodBoost extends AsmMethodBoost {
mv.visitMaxs(20, 20); mv.visitMaxs(20, 20);
mv.visitEnd(); mv.visitEnd();
CachedAction action = new CachedAction( CachedAction action = new CachedAction(
new CachedEntry(cached), method, serviceType, methodBean.paramNameArray(method), dynFieldName); new CachedEntry(cached, method),
method,
serviceType,
methodBean.paramNameArray(method),
dynFieldName);
actions.put(dynFieldName, action); actions.put(dynFieldName, action);
} }
{ // ThrowSupplier { // ThrowSupplier
@@ -226,7 +230,7 @@ public class CachedAsmMethodBoost extends AsmMethodBoost {
String dynFieldName = cached.dynField(); String dynFieldName = cached.dynField();
AsmMethodBean methodBean = AsmMethodBean.get(methodBeans, method); AsmMethodBean methodBean = AsmMethodBean.get(methodBeans, method);
CachedAction action = new CachedAction( CachedAction action = new CachedAction(
new CachedEntry(cached), new CachedEntry(cached, method),
method, method,
serviceType, serviceType,
methodBean.paramNameArray(method), methodBean.paramNameArray(method),

View File

@@ -3,9 +3,11 @@
*/ */
package org.redkale.cached.spi; package org.redkale.cached.spi;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.redkale.cached.Cached; import org.redkale.cached.Cached;
import org.redkale.convert.json.JsonConvert; import org.redkale.convert.json.JsonConvert;
import org.redkale.util.Utility;
/** /**
* 缓存信息的基本对象 * 缓存信息的基本对象
@@ -36,9 +38,9 @@ public class CachedEntry {
public CachedEntry() {} public CachedEntry() {}
public CachedEntry(DynForCached cached) { public CachedEntry(DynForCached cached, Method method) {
this.manager = cached.manager(); this.manager = cached.manager();
this.name = cached.name(); this.name = Utility.isBlank(cached.name()) ? method.getName() : cached.name();
this.key = cached.key(); this.key = cached.key();
this.localLimit = cached.localLimit(); this.localLimit = cached.localLimit();
this.localExpire = cached.localExpire(); this.localExpire = cached.localExpire();
@@ -47,9 +49,9 @@ public class CachedEntry {
this.nullable = cached.nullable(); this.nullable = cached.nullable();
} }
public CachedEntry(Cached cached) { public CachedEntry(Cached cached, Method method) {
this.manager = cached.manager(); this.manager = cached.manager();
this.name = cached.name(); this.name = Utility.isBlank(cached.name()) ? method.getName() : cached.name();
this.key = cached.key(); this.key = cached.key();
this.localLimit = cached.localLimit(); this.localLimit = cached.localLimit();
this.localExpire = cached.localExpire(); this.localExpire = cached.localExpire();