diff --git a/src/main/java/org/redisson/Redisson.java b/src/main/java/org/redisson/Redisson.java index 4c9430562..696428792 100755 --- a/src/main/java/org/redisson/Redisson.java +++ b/src/main/java/org/redisson/Redisson.java @@ -94,11 +94,11 @@ public class Redisson implements RedissonClient { /** - * Creates an Redisson instance + * Create sync/async Redisson instance with default config * * @return Redisson instance */ - public static Redisson create() { + public static RedissonClient create() { Config config = new Config(); config.useSingleServer().setAddress("127.0.0.1:6379"); // config.useMasterSlaveConnection().setMasterAddress("127.0.0.1:6379").addSlaveAddress("127.0.0.1:6389").addSlaveAddress("127.0.0.1:6399"); @@ -108,15 +108,34 @@ public class Redisson implements RedissonClient { } /** - * Creates an Redisson instance with configuration + * Create sync/async Redisson instance with provided config * * @param config * @return Redisson instance */ - public static Redisson create(Config config) { + public static RedissonClient create(Config config) { return new Redisson(config); } + /** + * Create reactive Redisson instance with default config + * + * @return Redisson instance + */ + public static RedissonClient createReactive() { + Config config = new Config(); + config.useSingleServer().setAddress("127.0.0.1:6379"); +// config.useMasterSlaveConnection().setMasterAddress("127.0.0.1:6379").addSlaveAddress("127.0.0.1:6389").addSlaveAddress("127.0.0.1:6399"); +// config.useSentinelConnection().setMasterName("mymaster").addSentinelAddress("127.0.0.1:26389", "127.0.0.1:26379"); +// config.useClusterServers().addNodeAddress("127.0.0.1:7000"); + return create(config); + } + + /** + * Create reactive Redisson instance with provided config + * + * @return Redisson instance + */ public static RedissonReactiveClient createReactive(Config config) { return new RedissonReactive(config); } diff --git a/src/main/java/org/redisson/RedissonClient.java b/src/main/java/org/redisson/RedissonClient.java index 622d86125..ea77bce36 100755 --- a/src/main/java/org/redisson/RedissonClient.java +++ b/src/main/java/org/redisson/RedissonClient.java @@ -44,7 +44,7 @@ import org.redisson.core.RTopic; /** * Main Redisson interface for access - * to all redisson objects with sync and async interfaces. + * to all redisson objects with sync/async interface. * * @author Nikita Koksharov * @@ -52,7 +52,7 @@ import org.redisson.core.RTopic; public interface RedissonClient { /** - * Returns object holder by name. + * Returns object holder instance by name. * * @param name of object * @return @@ -60,7 +60,7 @@ public interface RedissonClient { RBucket getBucket(String name); /** - * Returns object holder by name + * Returns object holder instance by name * using provided codec for object. * * @param name of object @@ -70,12 +70,12 @@ public interface RedissonClient { RBucket getBucket(String name, Codec codec); /** - * Returns a list of object holder by a key pattern. + * Returns a list of object holder instances by a key pattern. */ List> getBuckets(String pattern); /** - * Returns HyperLogLog object by name. + * Returns HyperLogLog instance by name. * * @param name of object * @return @@ -83,7 +83,7 @@ public interface RedissonClient { RHyperLogLog getHyperLogLog(String name); /** - * Returns HyperLogLog object by name + * Returns HyperLogLog instance by name * using provided codec for hll objects. * * @param name of object @@ -93,7 +93,7 @@ public interface RedissonClient { RHyperLogLog getHyperLogLog(String name, Codec codec); /** - * Returns list object by name. + * Returns list instance by name. * * @param name of object * @return @@ -101,7 +101,7 @@ public interface RedissonClient { RList getList(String name); /** - * Returns list object by name + * Returns list instance by name * using provided codec for list objects. * * @param name of object diff --git a/src/main/java/org/redisson/api/RedissonReactiveClient.java b/src/main/java/org/redisson/api/RedissonReactiveClient.java index 1e247f8cc..721d61e72 100644 --- a/src/main/java/org/redisson/api/RedissonReactiveClient.java +++ b/src/main/java/org/redisson/api/RedissonReactiveClient.java @@ -23,41 +23,72 @@ import org.redisson.core.ClusterNode; import org.redisson.core.Node; import org.redisson.core.NodesGroup; +/** + * Main Redisson interface for access + * to all redisson objects with reactive interface. + * + * @author Nikita Koksharov + * + */ public interface RedissonReactiveClient { /** - * Returns object holder by name + * Returns object holder instance by name * * @param name of object * @return */ RBucketReactive getBucket(String name); + /** + * Returns object holder instance by name + * using provided codec for object. + * + * @param name of object + * @param object codec + * @return + */ RBucketReactive getBucket(String name, Codec codec); /** - * Returns a list of object holder by a key pattern + * Returns a list of object holder instances by a key pattern */ List> findBuckets(String pattern); /** - * Returns HyperLogLog object + * Returns HyperLogLog instance by name. * * @param name of object * @return */ RHyperLogLogReactive getHyperLogLog(String name); + /** + * Returns HyperLogLog instance by name + * using provided codec for hll objects. + * + * @param name of object + * @param object codec + * @return + */ RHyperLogLogReactive getHyperLogLog(String name, Codec codec); /** * Returns list instance by name. * - * @param name of list + * @param name of object * @return */ RListReactive getList(String name); + /** + * Returns list instance by name + * using provided codec for list objects. + * + * @param name of object + * @param list object codec + * @return + */ RListReactive getList(String name, Codec codec); /** @@ -68,6 +99,14 @@ public interface RedissonReactiveClient { */ RMapReactive getMap(String name); + /** + * Returns map instance by name + * using provided codec for both map keys and values. + * + * @param name of map + * @param map key and value codec + * @return + */ RMapReactive getMap(String name, Codec codec); /** @@ -78,16 +117,34 @@ public interface RedissonReactiveClient { */ RSetReactive getSet(String name); + /** + * Returns set instance by name + * using provided codec for set objects. + * + * @param name of set + * @param set object codec + * @return + */ RSetReactive getSet(String name, Codec codec); /** - * Returns Redis Sorted Set instance by name + * Returns Redis Sorted Set instance by name. + * This sorted set sorts objects by object score. * - * @param name + * @param name of scored sorted set * @return */ RScoredSortedSetReactive getScoredSortedSet(String name); + /** + * Returns Redis Sorted Set instance by name + * using provided codec for sorted set objects. + * This sorted set sorts objects by object score. + * + * @param name of scored sorted set + * @param scored sorted set object codec + * @return + */ RScoredSortedSetReactive getScoredSortedSet(String name, Codec codec); /** @@ -108,6 +165,14 @@ public interface RedissonReactiveClient { */ RTopicReactive getTopic(String name); + /** + * Returns topic instance by name + * using provided codec for messages. + * + * @param name of topic + * @param message codec + * @return + */ RTopicReactive getTopic(String name, Codec codec); /** @@ -123,6 +188,19 @@ public interface RedissonReactiveClient { */ RPatternTopicReactive getPatternTopic(String pattern); + /** + * Returns topic instance satisfies by pattern name + * using provided codec for messages. + * + * 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 of the topic + * @param message codec + * @return + */ RPatternTopicReactive getPatternTopic(String pattern, Codec codec); /** @@ -133,6 +211,14 @@ public interface RedissonReactiveClient { */ RQueueReactive getQueue(String name); + /** + * Returns queue instance by name + * using provided codec for queue objects. + * + * @param name of queue + * @param queue objects codec + * @return + */ RQueueReactive getQueue(String name, Codec codec); /** @@ -143,6 +229,14 @@ public interface RedissonReactiveClient { */ RBlockingQueueReactive getBlockingQueue(String name); + /** + * Returns blocking queue instance by name + * using provided codec for queue objects. + * + * @param name of queue + * @param queue objects codec + * @return + */ RBlockingQueueReactive getBlockingQueue(String name, Codec codec); /** @@ -153,6 +247,14 @@ public interface RedissonReactiveClient { */ RDequeReactive getDeque(String name); + /** + * Returns deque instance by name + * using provided codec for deque objects. + * + * @param name of deque + * @param deque objects codec + * @return + */ RDequeReactive getDeque(String name, Codec codec); /** @@ -163,6 +265,12 @@ public interface RedissonReactiveClient { */ RAtomicLongReactive getAtomicLong(String name); + /** + * Returns bitSet instance by name. + * + * @param name of bitSet + * @return + */ RBitSetReactive getBitSet(String name); /**