findKeysByPattern response interface changed

pull/243/head
Nikita 10 years ago
parent fcd72d9ba8
commit aea51b6f66

@ -15,6 +15,7 @@
*/
package org.redisson;
import java.util.Collection;
import java.util.List;
import java.util.Queue;
@ -71,7 +72,7 @@ public interface CommandExecutor {
<T, R> R write(String key, RedisCommand<T> command, Object ... params);
<T, R> Future<Queue<R>> readAllAsync(RedisCommand<T> command, Object ... params);
<T, R> Future<Collection<R>> readAllAsync(RedisCommand<T> command, Object ... params);
<T> Future<Void> writeAllAsync(RedisCommand<T> command, Object ... params);

@ -68,8 +68,8 @@ public class CommandExecutorService implements CommandExecutor {
return connectionManager;
}
public <T, R> Future<Queue<R>> readAllAsync(RedisCommand<T> command, Object ... params) {
final Promise<Queue<R>> mainPromise = connectionManager.newPromise();
public <T, R> Future<Collection<R>> readAllAsync(RedisCommand<T> command, Object ... params) {
final Promise<Collection<R>> mainPromise = connectionManager.newPromise();
Promise<R> promise = new DefaultPromise<R>() {
Queue<R> results = new ConcurrentLinkedQueue<R>();
AtomicInteger counter = new AtomicInteger(connectionManager.getEntries().keySet().size());

@ -16,9 +16,9 @@
package org.redisson;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Queue;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
@ -125,8 +125,8 @@ public class Redisson implements RedissonClient {
*/
@Override
public <V> List<RBucket<V>> getBuckets(String pattern) {
Future<Queue<String>> r = commandExecutor.readAllAsync(RedisCommands.KEYS, pattern);
Queue<String> keys = commandExecutor.get(r);
Future<Collection<String>> r = commandExecutor.readAllAsync(RedisCommands.KEYS, pattern);
Collection<String> keys = commandExecutor.get(r);
List<RBucket<V>> buckets = new ArrayList<RBucket<V>>(keys.size());
for (Object key : keys) {
if(key != null) {
@ -326,7 +326,7 @@ public class Redisson implements RedissonClient {
* @return
*/
@Override
public Queue<String> findKeysByPattern(String pattern) {
public Collection<String> findKeysByPattern(String pattern) {
return commandExecutor.get(findKeysByPatternAsync(pattern));
}
@ -342,7 +342,7 @@ public class Redisson implements RedissonClient {
* @return
*/
@Override
public Future<Queue<String>> findKeysByPatternAsync(String pattern) {
public Future<Collection<String>> findKeysByPatternAsync(String pattern) {
return commandExecutor.readAllAsync(RedisCommands.KEYS, pattern);
}

@ -15,12 +15,27 @@
*/
package org.redisson;
import org.redisson.core.*;
import java.util.Collection;
import java.util.List;
import io.netty.util.concurrent.Future;
import org.redisson.core.RAtomicLong;
import org.redisson.core.RBatch;
import org.redisson.core.RBlockingQueue;
import org.redisson.core.RBucket;
import org.redisson.core.RCountDownLatch;
import org.redisson.core.RDeque;
import org.redisson.core.RHyperLogLog;
import org.redisson.core.RList;
import org.redisson.core.RLock;
import org.redisson.core.RMap;
import org.redisson.core.RPatternTopic;
import org.redisson.core.RQueue;
import org.redisson.core.RScript;
import org.redisson.core.RSet;
import org.redisson.core.RSortedSet;
import org.redisson.core.RTopic;
import java.util.List;
import java.util.Queue;
import io.netty.util.concurrent.Future;
public interface RedissonClient {
@ -188,7 +203,7 @@ public interface RedissonClient {
* @param pattern
* @return
*/
Queue<String> findKeysByPattern(String pattern);
Collection<String> findKeysByPattern(String pattern);
/**
* Find keys by key search pattern in async mode
@ -201,7 +216,7 @@ public interface RedissonClient {
* @param pattern
* @return
*/
Future<Queue<String>> findKeysByPatternAsync(String pattern);
Future<Collection<String>> findKeysByPatternAsync(String pattern);
/**
* Delete multiple objects by a key pattern

Loading…
Cancel
Save