This commit is contained in:
@@ -75,6 +75,11 @@ public class CacheMemorySource<V extends Object> extends AbstractService impleme
|
||||
this.needStore = !flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupportQueryList() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(AnyValue conf) {
|
||||
if (this.convert == null) this.convert = this.defaultConvert;
|
||||
@@ -155,7 +160,7 @@ public class CacheMemorySource<V extends Object> extends AbstractService impleme
|
||||
}
|
||||
if (remoteSource != null && !Sncp.isRemote(this)) {
|
||||
SncpClient client = Sncp.getSncpClient((Service) remoteSource);
|
||||
if (client != null && client.getRemoteGroupTransport() != null) {
|
||||
if (client != null && client.getRemoteGroupTransport() != null && remoteSource.isSupportQueryList()) {
|
||||
super.runAsync(() -> {
|
||||
try {
|
||||
CompletableFuture<List<CacheEntry<Object>>> listFuture = remoteSource.queryListAsync();
|
||||
|
||||
@@ -30,6 +30,11 @@ public interface CacheSource<V extends Object> {
|
||||
return true;
|
||||
}
|
||||
|
||||
//是否支持queryList 或 queryListAsync 方法
|
||||
default boolean isSupportQueryList() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean exists(final String key);
|
||||
|
||||
public V get(final String key);
|
||||
@@ -104,7 +109,12 @@ public interface CacheSource<V extends Object> {
|
||||
public CompletableFuture<List<CacheEntry< Object>>> queryListAsync();
|
||||
|
||||
default CompletableFuture<Boolean> isOpenAsync() {
|
||||
return CompletableFuture.completedFuture(true);
|
||||
return CompletableFuture.completedFuture(isOpen());
|
||||
}
|
||||
|
||||
//是否支持queryList 或 queryListAsync 方法
|
||||
default CompletableFuture<Boolean> isSupportQueryListAsync() {
|
||||
return CompletableFuture.completedFuture(isSupportQueryList());
|
||||
}
|
||||
|
||||
public static enum CacheEntryType {
|
||||
|
||||
Reference in New Issue
Block a user