RKeysReactive.findKeysByPattern added. #210

pull/337/head
Nikita 9 years ago
parent 66b31a4af0
commit f47006a903

@ -150,6 +150,22 @@ public class RedissonKeysReactive implements RKeysReactive {
};
}
/**
* Find keys by key search pattern by one Redis call
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern
* @return
*/
@Override
public Publisher<Collection<String>> findKeysByPattern(String pattern) {
return commandExecutor.readAllObservable(RedisCommands.KEYS, pattern);
}
@Override
public Publisher<String> randomKey() {
return commandExecutor.readRandomObservable(RedisCommands.RANDOM_KEY);

@ -15,8 +15,12 @@
*/
package org.redisson.core;
import java.util.Collection;
import org.reactivestreams.Publisher;
import io.netty.util.concurrent.Future;
public interface RKeysReactive {
Publisher<String> getKeys();
@ -32,6 +36,19 @@ public interface RKeysReactive {
*/
Publisher<Integer> getSlot(String key);
/**
* Find keys by key search pattern by one Redis call
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern
* @return
*/
Publisher<Collection<String>> findKeysByPattern(String pattern);
/**
* Get random key in mode
*

@ -1,12 +1,17 @@
package org.redisson;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
import org.redisson.core.RBucket;
import org.redisson.core.RBucketReactive;
import org.redisson.core.RMap;
import org.redisson.core.RMapReactive;
public class RedissonKeysReactiveTest extends BaseReactiveTest {

Loading…
Cancel
Save