优化CacheSource

This commit is contained in:
Redkale
2022-12-26 22:59:16 +08:00
parent 441a74a7c9
commit 06bd653b24
2 changed files with 7 additions and 7 deletions

View File

@@ -1614,7 +1614,7 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public int dbsize() {
public long dbsize() {
return container.size();
}
@@ -1649,8 +1649,8 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public CompletableFuture<Integer> dbsizeAsync() {
return CompletableFuture.completedFuture(container.size());
public CompletableFuture<Long> dbsizeAsync() {
return CompletableFuture.completedFuture((long) container.size());
}
@Override

View File

@@ -297,7 +297,7 @@ public interface CacheSource extends Resourcable {
public List<String> keys(String pattern);
public int dbsize();
public long dbsize();
//------------------------ collection ------------------------
@Deprecated
@@ -598,7 +598,7 @@ public interface CacheSource extends Resourcable {
public CompletableFuture<List<String>> keysAsync(String pattern);
public CompletableFuture<Integer> dbsizeAsync();
public CompletableFuture<Long> dbsizeAsync();
//------------------------ collectionAsync ------------------------
@Deprecated
@@ -1069,11 +1069,11 @@ public interface CacheSource extends Resourcable {
@Deprecated
default CompletableFuture<Integer> getKeySizeAsync() {
return dbsizeAsync();
return dbsizeAsync().thenApply(v -> v.intValue());
}
@Deprecated
default int getKeySize() {
return dbsize();
return (int) dbsize();
}
}