CacheSource.getSet系列方法还原

This commit is contained in:
Redkale
2022-12-07 19:19:30 +08:00
parent 1247c37d71
commit 23e68e2d0d
2 changed files with 25 additions and 25 deletions

View File

@@ -335,7 +335,7 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public String setGetString(String key, String value) {
public String getSetString(String key, String value) {
String old = getString(key);
setString(key, value);
return old;
@@ -350,7 +350,7 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public long setGetLong(String key, long value, long defValue) {
public long getSetLong(String key, long value, long defValue) {
long old = getLong(key, defValue);
setLong(key, value);
return old;
@@ -474,8 +474,8 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public CompletableFuture<Long> setGetLongAsync(final String key, long value, long defValue) {
return CompletableFuture.supplyAsync(() -> setGetLong(key, value, defValue), getExecutor());
public CompletableFuture<Long> getSetLongAsync(final String key, long value, long defValue) {
return CompletableFuture.supplyAsync(() -> getSetLong(key, value, defValue), getExecutor());
}
@Override
@@ -584,14 +584,14 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public <T> T setGet(String key, Type type, T value) {
public <T> T getSet(String key, Type type, T value) {
T old = get(key, type);
set(CacheEntryType.OBJECT, key, value);
return old;
}
@Override
public <T> T setGet(String key, Convert convert, Type type, T value) {
public <T> T getSet(String key, Convert convert, Type type, T value) {
T old = get(key, type);
set(CacheEntryType.OBJECT, key, value);
return old;
@@ -623,13 +623,13 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public <T> CompletableFuture<T> setGetAsync(String key, Type type, T value) {
return CompletableFuture.runAsync(() -> setGet(key, type, value), getExecutor()).whenComplete(futureCompleteConsumer);
public <T> CompletableFuture<T> getSetAsync(String key, Type type, T value) {
return CompletableFuture.runAsync(() -> getSet(key, type, value), getExecutor()).whenComplete(futureCompleteConsumer);
}
@Override
public <T> CompletableFuture<T> setGetAsync(String key, Convert convert, Type type, T value) {
return CompletableFuture.runAsync(() -> setGet(key, convert, type, value), getExecutor()).whenComplete(futureCompleteConsumer);
public <T> CompletableFuture<T> getSetAsync(String key, Convert convert, Type type, T value) {
return CompletableFuture.runAsync(() -> getSet(key, convert, type, value), getExecutor()).whenComplete(futureCompleteConsumer);
}
@Override
@@ -638,8 +638,8 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public CompletableFuture<String> setGetStringAsync(String key, String value) {
return CompletableFuture.runAsync(() -> setGetString(key, value), getExecutor()).whenComplete(futureCompleteConsumer);
public CompletableFuture<String> getSetStringAsync(String key, String value) {
return CompletableFuture.runAsync(() -> getSetString(key, value), getExecutor()).whenComplete(futureCompleteConsumer);
}
@Override
@@ -1243,7 +1243,7 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public byte[] setGetBytes(final String key, byte[] value) {
public byte[] getSetBytes(final String key, byte[] value) {
byte[] old = getBytes(key);
setBytes(key, value);
return old;
@@ -1255,8 +1255,8 @@ public final class CacheMemorySource extends AbstractCacheSource {
}
@Override
public CompletableFuture<byte[]> setGetBytesAsync(final String key, byte[] value) {
return CompletableFuture.supplyAsync(() -> setGetBytes(key, value), getExecutor()).whenComplete(futureCompleteConsumer);
public CompletableFuture<byte[]> getSetBytesAsync(final String key, byte[] value) {
return CompletableFuture.supplyAsync(() -> getSetBytes(key, value), getExecutor()).whenComplete(futureCompleteConsumer);
}
@Override

View File

@@ -90,9 +90,9 @@ public interface CacheSource extends Resourcable {
public <T> void set(final String key, final Convert convert, final Type type, final T value);
public <T> T setGet(final String key, final Type type, final T value);
public <T> T getSet(final String key, final Type type, final T value);
public <T> T setGet(final String key, final Convert convert, final Type type, final T value);
public <T> T getSet(final String key, final Convert convert, final Type type, final T value);
public <T> void set(final int expireSeconds, final String key, final Convert convert, final T value);
@@ -138,7 +138,7 @@ public interface CacheSource extends Resourcable {
public byte[] getBytes(final String key);
public byte[] setGetBytes(final String key, final byte[] value);
public byte[] getSetBytes(final String key, final byte[] value);
public byte[] getBytesAndRefresh(final String key, final int expireSeconds);
@@ -160,7 +160,7 @@ public interface CacheSource extends Resourcable {
public String getString(final String key);
public String setGetString(final String key, final String value);
public String getSetString(final String key, final String value);
public String getStringAndRefresh(final String key, final int expireSeconds);
@@ -194,7 +194,7 @@ public interface CacheSource extends Resourcable {
public long getLong(final String key, long defValue);
public long setGetLong(final String key, long value, long defValue);
public long getSetLong(final String key, long value, long defValue);
public long getLongAndRefresh(final String key, final int expireSeconds, long defValue);
@@ -241,9 +241,9 @@ public interface CacheSource extends Resourcable {
public <T> CompletableFuture<Void> setAsync(final String key, final Convert convert, final Type type, final T value);
public <T> CompletableFuture<T> setGetAsync(final String key, final Type type, final T value);
public <T> CompletableFuture<T> getSetAsync(final String key, final Type type, final T value);
public <T> CompletableFuture<T> setGetAsync(final String key, final Convert convert, final Type type, final T value);
public <T> CompletableFuture<T> getSetAsync(final String key, final Convert convert, final Type type, final T value);
public <T> CompletableFuture<Void> setAsync(final int expireSeconds, final String key, final Convert convert, final T value);
@@ -331,7 +331,7 @@ public interface CacheSource extends Resourcable {
public CompletableFuture<byte[]> getBytesAsync(final String key);
public CompletableFuture<byte[]> setGetBytesAsync(final String key, final byte[] value);
public CompletableFuture<byte[]> getSetBytesAsync(final String key, final byte[] value);
public CompletableFuture<byte[]> getBytesAndRefreshAsync(final String key, final int expireSeconds);
@@ -353,7 +353,7 @@ public interface CacheSource extends Resourcable {
public CompletableFuture<String> getStringAsync(final String key);
public CompletableFuture<String> setGetStringAsync(final String key, final String value);
public CompletableFuture<String> getSetStringAsync(final String key, final String value);
public CompletableFuture<String> getStringAndRefreshAsync(final String key, final int expireSeconds);
@@ -387,7 +387,7 @@ public interface CacheSource extends Resourcable {
public CompletableFuture<Long> getLongAsync(final String key, long defValue);
public CompletableFuture<Long> setGetLongAsync(final String key, long value, long defValue);
public CompletableFuture<Long> getSetLongAsync(final String key, long value, long defValue);
public CompletableFuture<Long> getLongAndRefreshAsync(final String key, final int expireSeconds, long defValue);