comments added

pull/337/head
Nikita 9 years ago
parent 1f4ecff8cd
commit a9055f1c3b

@ -94,11 +94,11 @@ public class Redisson implements RedissonClient {
/** /**
* Creates an Redisson instance * Create sync/async Redisson instance with default config
* *
* @return Redisson instance * @return Redisson instance
*/ */
public static Redisson create() { public static RedissonClient create() {
Config config = new Config(); Config config = new Config();
config.useSingleServer().setAddress("127.0.0.1:6379"); 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.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 * @param config
* @return Redisson instance * @return Redisson instance
*/ */
public static Redisson create(Config config) { public static RedissonClient create(Config config) {
return new Redisson(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) { public static RedissonReactiveClient createReactive(Config config) {
return new RedissonReactive(config); return new RedissonReactive(config);
} }

@ -44,7 +44,7 @@ import org.redisson.core.RTopic;
/** /**
* Main Redisson interface for access * 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 * @author Nikita Koksharov
* *
@ -52,7 +52,7 @@ import org.redisson.core.RTopic;
public interface RedissonClient { public interface RedissonClient {
/** /**
* Returns object holder by name. * Returns object holder instance by name.
* *
* @param name of object * @param name of object
* @return * @return
@ -60,7 +60,7 @@ public interface RedissonClient {
<V> RBucket<V> getBucket(String name); <V> RBucket<V> getBucket(String name);
/** /**
* Returns object holder by name * Returns object holder instance by name
* using provided codec for object. * using provided codec for object.
* *
* @param name of object * @param name of object
@ -70,12 +70,12 @@ public interface RedissonClient {
<V> RBucket<V> getBucket(String name, Codec codec); <V> RBucket<V> 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.
*/ */
<V> List<RBucket<V>> getBuckets(String pattern); <V> List<RBucket<V>> getBuckets(String pattern);
/** /**
* Returns HyperLogLog object by name. * Returns HyperLogLog instance by name.
* *
* @param name of object * @param name of object
* @return * @return
@ -83,7 +83,7 @@ public interface RedissonClient {
<V> RHyperLogLog<V> getHyperLogLog(String name); <V> RHyperLogLog<V> getHyperLogLog(String name);
/** /**
* Returns HyperLogLog object by name * Returns HyperLogLog instance by name
* using provided codec for hll objects. * using provided codec for hll objects.
* *
* @param name of object * @param name of object
@ -93,7 +93,7 @@ public interface RedissonClient {
<V> RHyperLogLog<V> getHyperLogLog(String name, Codec codec); <V> RHyperLogLog<V> getHyperLogLog(String name, Codec codec);
/** /**
* Returns list object by name. * Returns list instance by name.
* *
* @param name of object * @param name of object
* @return * @return
@ -101,7 +101,7 @@ public interface RedissonClient {
<V> RList<V> getList(String name); <V> RList<V> getList(String name);
/** /**
* Returns list object by name * Returns list instance by name
* using provided codec for list objects. * using provided codec for list objects.
* *
* @param name of object * @param name of object

@ -23,41 +23,72 @@ import org.redisson.core.ClusterNode;
import org.redisson.core.Node; import org.redisson.core.Node;
import org.redisson.core.NodesGroup; import org.redisson.core.NodesGroup;
/**
* Main Redisson interface for access
* to all redisson objects with reactive interface.
*
* @author Nikita Koksharov
*
*/
public interface RedissonReactiveClient { public interface RedissonReactiveClient {
/** /**
* Returns object holder by name * Returns object holder instance by name
* *
* @param name of object * @param name of object
* @return * @return
*/ */
<V> RBucketReactive<V> getBucket(String name); <V> RBucketReactive<V> getBucket(String name);
/**
* Returns object holder instance by name
* using provided codec for object.
*
* @param name of object
* @param object codec
* @return
*/
<V> RBucketReactive<V> getBucket(String name, Codec codec); <V> RBucketReactive<V> 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
*/ */
<V> List<RBucketReactive<V>> findBuckets(String pattern); <V> List<RBucketReactive<V>> findBuckets(String pattern);
/** /**
* Returns HyperLogLog object * Returns HyperLogLog instance by name.
* *
* @param name of object * @param name of object
* @return * @return
*/ */
<V> RHyperLogLogReactive<V> getHyperLogLog(String name); <V> RHyperLogLogReactive<V> getHyperLogLog(String name);
/**
* Returns HyperLogLog instance by name
* using provided codec for hll objects.
*
* @param name of object
* @param object codec
* @return
*/
<V> RHyperLogLogReactive<V> getHyperLogLog(String name, Codec codec); <V> RHyperLogLogReactive<V> getHyperLogLog(String name, Codec codec);
/** /**
* Returns list instance by name. * Returns list instance by name.
* *
* @param name of list * @param name of object
* @return * @return
*/ */
<V> RListReactive<V> getList(String name); <V> RListReactive<V> getList(String name);
/**
* Returns list instance by name
* using provided codec for list objects.
*
* @param name of object
* @param list object codec
* @return
*/
<V> RListReactive<V> getList(String name, Codec codec); <V> RListReactive<V> getList(String name, Codec codec);
/** /**
@ -68,6 +99,14 @@ public interface RedissonReactiveClient {
*/ */
<K, V> RMapReactive<K, V> getMap(String name); <K, V> RMapReactive<K, V> 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
*/
<K, V> RMapReactive<K, V> getMap(String name, Codec codec); <K, V> RMapReactive<K, V> getMap(String name, Codec codec);
/** /**
@ -78,16 +117,34 @@ public interface RedissonReactiveClient {
*/ */
<V> RSetReactive<V> getSet(String name); <V> RSetReactive<V> getSet(String name);
/**
* Returns set instance by name
* using provided codec for set objects.
*
* @param name of set
* @param set object codec
* @return
*/
<V> RSetReactive<V> getSet(String name, Codec codec); <V> RSetReactive<V> 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 * @return
*/ */
<V> RScoredSortedSetReactive<V> getScoredSortedSet(String name); <V> RScoredSortedSetReactive<V> 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
*/
<V> RScoredSortedSetReactive<V> getScoredSortedSet(String name, Codec codec); <V> RScoredSortedSetReactive<V> getScoredSortedSet(String name, Codec codec);
/** /**
@ -108,6 +165,14 @@ public interface RedissonReactiveClient {
*/ */
<M> RTopicReactive<M> getTopic(String name); <M> RTopicReactive<M> getTopic(String name);
/**
* Returns topic instance by name
* using provided codec for messages.
*
* @param name of topic
* @param message codec
* @return
*/
<M> RTopicReactive<M> getTopic(String name, Codec codec); <M> RTopicReactive<M> getTopic(String name, Codec codec);
/** /**
@ -123,6 +188,19 @@ public interface RedissonReactiveClient {
*/ */
<M> RPatternTopicReactive<M> getPatternTopic(String pattern); <M> RPatternTopicReactive<M> 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
*/
<M> RPatternTopicReactive<M> getPatternTopic(String pattern, Codec codec); <M> RPatternTopicReactive<M> getPatternTopic(String pattern, Codec codec);
/** /**
@ -133,6 +211,14 @@ public interface RedissonReactiveClient {
*/ */
<V> RQueueReactive<V> getQueue(String name); <V> RQueueReactive<V> getQueue(String name);
/**
* Returns queue instance by name
* using provided codec for queue objects.
*
* @param name of queue
* @param queue objects codec
* @return
*/
<V> RQueueReactive<V> getQueue(String name, Codec codec); <V> RQueueReactive<V> getQueue(String name, Codec codec);
/** /**
@ -143,6 +229,14 @@ public interface RedissonReactiveClient {
*/ */
<V> RBlockingQueueReactive<V> getBlockingQueue(String name); <V> RBlockingQueueReactive<V> getBlockingQueue(String name);
/**
* Returns blocking queue instance by name
* using provided codec for queue objects.
*
* @param name of queue
* @param queue objects codec
* @return
*/
<V> RBlockingQueueReactive<V> getBlockingQueue(String name, Codec codec); <V> RBlockingQueueReactive<V> getBlockingQueue(String name, Codec codec);
/** /**
@ -153,6 +247,14 @@ public interface RedissonReactiveClient {
*/ */
<V> RDequeReactive<V> getDeque(String name); <V> RDequeReactive<V> getDeque(String name);
/**
* Returns deque instance by name
* using provided codec for deque objects.
*
* @param name of deque
* @param deque objects codec
* @return
*/
<V> RDequeReactive<V> getDeque(String name, Codec codec); <V> RDequeReactive<V> getDeque(String name, Codec codec);
/** /**
@ -163,6 +265,12 @@ public interface RedissonReactiveClient {
*/ */
RAtomicLongReactive getAtomicLong(String name); RAtomicLongReactive getAtomicLong(String name);
/**
* Returns bitSet instance by name.
*
* @param name of bitSet
* @return
*/
RBitSetReactive getBitSet(String name); RBitSetReactive getBitSet(String name);
/** /**

Loading…
Cancel
Save