CacheSource增加flushdb方法
This commit is contained in:
@@ -1547,8 +1547,8 @@ public final class Application {
|
||||
this.clusterAgent.start();
|
||||
}
|
||||
if (this.messageAgents != null) {
|
||||
if (logger.isLoggable(Level.FINER)) {
|
||||
logger.log(Level.FINER, "MessageAgent starting");
|
||||
if (logger.isLoggable(Level.FINE)) {
|
||||
logger.log(Level.FINE, "MessageAgent starting");
|
||||
}
|
||||
long s = System.currentTimeMillis();
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
|
||||
@@ -643,6 +643,9 @@ public abstract class NodeServer {
|
||||
}
|
||||
|
||||
protected boolean acceptsComponent(Class<? extends Service> serviceImplClass) {
|
||||
if (Modifier.isAbstract(serviceImplClass.getModifiers()) || Modifier.isInterface(serviceImplClass.getModifiers())) {
|
||||
return false;
|
||||
}
|
||||
if (MessageConsumer.class.isAssignableFrom(serviceImplClass)) {
|
||||
ResourceConsumer mqConsumer = serviceImplClass.getAnnotation(ResourceConsumer.class);
|
||||
if (mqConsumer == null) {
|
||||
@@ -650,6 +653,7 @@ public abstract class NodeServer {
|
||||
}
|
||||
MessageAgent mqAgent = application.getMessageAgent(mqConsumer.mq());
|
||||
if (mqAgent == null) {
|
||||
logger.info("not found MessageAgent(mq = " + mqConsumer.mq() + ")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1812,6 +1812,26 @@ public final class CacheMemorySource extends AbstractCacheSource {
|
||||
return container.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushdb() {
|
||||
container.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> flushdbAsync() {
|
||||
return CompletableFuture.runAsync(() -> flushdb(), getExecutor()).whenComplete(futureCompleteConsumer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushall() {
|
||||
container.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> flushallAsync() {
|
||||
return CompletableFuture.runAsync(() -> flushall(), getExecutor()).whenComplete(futureCompleteConsumer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> keys(String pattern) {
|
||||
if (pattern == null || pattern.isEmpty()) {
|
||||
@@ -1835,7 +1855,7 @@ public final class CacheMemorySource extends AbstractCacheSource {
|
||||
return rs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> keysStartsWith(String startsWith) {
|
||||
if (startsWith == null) {
|
||||
|
||||
@@ -341,6 +341,10 @@ public interface CacheSource extends Resourcable {
|
||||
|
||||
public long dbsize();
|
||||
|
||||
public void flushdb();
|
||||
|
||||
public void flushall();
|
||||
|
||||
//---------------------- CompletableFuture 异步版 ---------------------------------
|
||||
default CompletableFuture<Boolean> isOpenAsync() {
|
||||
return CompletableFuture.completedFuture(isOpen());
|
||||
@@ -650,6 +654,10 @@ public interface CacheSource extends Resourcable {
|
||||
|
||||
public CompletableFuture<Long> dbsizeAsync();
|
||||
|
||||
public CompletableFuture<Void> flushdbAsync();
|
||||
|
||||
public CompletableFuture<Void> flushallAsync();
|
||||
|
||||
//-------------------------- 过期方法 ----------------------------------
|
||||
@Deprecated(since = "2.8.0")
|
||||
public <T> Collection<T> getCollection(final String key, final Type componentType);
|
||||
|
||||
Reference in New Issue
Block a user