new comments added

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

@ -121,12 +121,6 @@ public class Redisson implements RedissonClient {
return new RedissonReactive(config);
}
/**
* Returns object holder by name
*
* @param name of object
* @return
*/
@Override
public <V> RBucket<V> getBucket(String name) {
return new RedissonBucket<V>(commandExecutor, name);
@ -137,16 +131,6 @@ public class Redisson implements RedissonClient {
return new RedissonBucket<V>(codec, commandExecutor, name);
}
/**
* Returns a list of object holder by a key pattern
*
* 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
*
*/
@Override
public <V> List<RBucket<V>> getBuckets(String pattern) {
Future<Collection<String>> r = commandExecutor.readAllAsync(RedisCommands.KEYS, pattern);
@ -160,13 +144,6 @@ public class Redisson implements RedissonClient {
return buckets;
}
/**
* Returns HyperLogLog object
*
* @param name of object
* @return
*/
@Override
public <V> RHyperLogLog<V> getHyperLogLog(String name) {
return new RedissonHyperLogLog<V>(commandExecutor, name);
@ -177,13 +154,6 @@ public class Redisson implements RedissonClient {
return new RedissonHyperLogLog<V>(codec, commandExecutor, name);
}
/**
* Returns distributed list instance by name.
*
* @param name of the distributed list
* @return distributed list
*/
@Override
public <V> RList<V> getList(String name) {
return new RedissonList<V>(commandExecutor, name);
@ -194,12 +164,6 @@ public class Redisson implements RedissonClient {
return new RedissonList<V>(codec, commandExecutor, name);
}
/**
* Returns distributed map instance by name.
*
* @param name of the distributed map
* @return distributed map
*/
@Override
public <K, V> RMap<K, V> getMap(String name) {
return new RedissonMap<K, V>(commandExecutor, name);
@ -210,23 +174,11 @@ public class Redisson implements RedissonClient {
return new RedissonMap<K, V>(codec, commandExecutor, name);
}
/**
* Returns distributed lock instance by name.
*
* @param name of the distributed lock
* @return distributed lock
*/
@Override
public RLock getLock(String name) {
return new RedissonLock(commandExecutor, name, id);
}
/**
* Returns distributed set instance by name.
*
* @param name of the distributed set
* @return distributed set
*/
@Override
public <V> RSet<V> getSet(String name) {
return new RedissonSet<V>(commandExecutor, name);
@ -237,23 +189,11 @@ public class Redisson implements RedissonClient {
return new RedissonSet<V>(codec, commandExecutor, name);
}
/**
* Returns script with eval-operations support
*
* @return
*/
@Override
public RScript getScript() {
return new RedissonScript(commandExecutor);
}
/**
* Returns distributed sorted set instance by name.
*
* @param name of the distributed set
* @return distributed set
*/
@Override
public <V> RSortedSet<V> getSortedSet(String name) {
return new RedissonSortedSet<V>(commandExecutor, name);
@ -264,13 +204,6 @@ public class Redisson implements RedissonClient {
return new RedissonSortedSet<V>(codec, commandExecutor, name);
}
/**
* Returns Redis Sorted Set instance by name
*
* @param name
* @return
*/
@Override
public <V> RScoredSortedSet<V> getScoredSortedSet(String name) {
return new RedissonScoredSortedSet<V>(commandExecutor, name);
@ -281,25 +214,11 @@ public class Redisson implements RedissonClient {
return new RedissonScoredSortedSet<V>(codec, commandExecutor, name);
}
/**
* Returns String based Redis Sorted Set instance by name
* All elements are inserted with the same score during addition,
* in order to force lexicographical ordering
*
* @param name
* @return
*/
@Override
public RLexSortedSet getLexSortedSet(String name) {
return new RedissonLexSortedSet(commandExecutor, name);
}
/**
* Returns topic instance by name.
*
* @param name of the distributed topic
* @return distributed topic
*/
@Override
public <M> RTopic<M> getTopic(String name) {
return new RedissonTopic<M>(commandExecutor, name);
@ -310,17 +229,6 @@ public class Redisson implements RedissonClient {
return new RedissonTopic<M>(codec, commandExecutor, name);
}
/**
* Returns topic instance satisfies by pattern name.
*
* 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
* @return
*/
@Override
public <M> RPatternTopic<M> getPatternTopic(String pattern) {
return new RedissonPatternTopic<M>(commandExecutor, pattern);
@ -331,13 +239,6 @@ public class Redisson implements RedissonClient {
return new RedissonPatternTopic<M>(codec, commandExecutor, pattern);
}
/**
* Returns distributed queue instance by name.
*
* @param name of the distributed queue
* @return distributed queue
*/
@Override
public <V> RQueue<V> getQueue(String name) {
return new RedissonQueue<V>(commandExecutor, name);
@ -348,12 +249,6 @@ public class Redisson implements RedissonClient {
return new RedissonQueue<V>(codec, commandExecutor, name);
}
/**
* Returns distributed blocking queue instance by name.
*
* @param name of the distributed blocking queue
* @return distributed queue
*/
@Override
public <V> RBlockingQueue<V> getBlockingQueue(String name) {
return new RedissonBlockingQueue<V>(commandExecutor, name);
@ -364,12 +259,6 @@ public class Redisson implements RedissonClient {
return new RedissonBlockingQueue<V>(codec, commandExecutor, name);
}
/**
* Returns distributed deque instance by name.
*
* @param name of the distributed queue
* @return distributed queue
*/
@Override
public <V> RDeque<V> getDeque(String name) {
return new RedissonDeque<V>(commandExecutor, name);
@ -380,23 +269,11 @@ public class Redisson implements RedissonClient {
return new RedissonDeque<V>(codec, commandExecutor, name);
}
/**
* Returns distributed "atomic long" instance by name.
*
* @param name of the distributed "atomic long"
* @return distributed "atomic long"
*/
@Override
public RAtomicLong getAtomicLong(String name) {
return new RedissonAtomicLong(commandExecutor, name);
}
/**
* Returns distributed "count down latch" instance by name.
*
* @param name of the distributed "count down latch"
* @return distributed "count down latch"
*/
@Override
public RCountDownLatch getCountDownLatch(String name) {
return new RedissonCountDownLatch(commandExecutor, name, id);
@ -407,51 +284,25 @@ public class Redisson implements RedissonClient {
return new RedissonBitSet(commandExecutor, name);
}
/**
* Returns keys operations.
* Each of Redis/Redisson object associated with own key
*
* @return
*/
@Override
public RKeys getKeys() {
return new RedissonKeys(commandExecutor);
}
/**
* Shuts down Redisson instance <b>NOT</b> Redis server
*/
@Override
public void shutdown() {
connectionManager.shutdown();
}
/**
* Allows to get configuration provided
* during Redisson instance creation. Further changes on
* this object not affect Redisson instance.
*
* @return Config object
*/
@Override
public Config getConfig() {
return config;
}
/**
* Get Redis nodes group for server operations
*
* @return
*/
public NodesGroup<Node> getNodesGroup() {
return new RedisNodes<Node>(connectionManager);
}
/**
* Get Redis cluster nodes group for server operations
*
* @return
*/
public NodesGroup<ClusterNode> getClusterNodesGroup() {
if (!config.isClusterConfig()) {
throw new IllegalStateException("Redisson not in cluster mode!");
@ -459,30 +310,16 @@ public class Redisson implements RedissonClient {
return new RedisNodes<ClusterNode>(connectionManager);
}
/**
* Delete all the keys of the currently selected database
*/
@Override
public void flushdb() {
commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHDB));
}
/**
* Delete all the keys of all the existing databases
*/
@Override
public void flushall() {
commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHALL));
}
/**
* Return batch object which executes group of
* command in pipeline.
*
* See <a href="http://redis.io/topics/pipelining">http://redis.io/topics/pipelining</a>
*
* @return
*/
@Override
public RBatch createBatch() {
return new RedissonBatch(connectionManager);

@ -42,41 +42,72 @@ import org.redisson.core.RSet;
import org.redisson.core.RSortedSet;
import org.redisson.core.RTopic;
/**
* Main Redisson interface for access
* to all redisson objects with sync and async interfaces.
*
* @author Nikita Koksharov
*
*/
public interface RedissonClient {
/**
* Returns object holder by name
* Returns object holder by name.
*
* @param name of object
* @return
*/
<V> RBucket<V> getBucket(String name);
/**
* Returns object holder by name
* using provided codec for object.
*
* @param name of object
* @param object codec
* @return
*/
<V> RBucket<V> getBucket(String name, Codec codec);
/**
* Returns a list of object holder by a key pattern
* Returns a list of object holder by a key pattern.
*/
<V> List<RBucket<V>> getBuckets(String pattern);
/**
* Returns HyperLogLog object
* Returns HyperLogLog object by name.
*
* @param name of object
* @return
*/
<V> RHyperLogLog<V> getHyperLogLog(String name);
/**
* Returns HyperLogLog object by name
* using provided codec for hll objects.
*
* @param name of object
* @param object codec
* @return
*/
<V> RHyperLogLog<V> getHyperLogLog(String name, Codec codec);
/**
* Returns list instance by name.
* Returns list object by name.
*
* @param name of list
* @param name of object
* @return
*/
<V> RList<V> getList(String name);
/**
* Returns list object by name
* using provided codec for list objects.
*
* @param name of object
* @param list object codec
* @return
*/
<V> RList<V> getList(String name, Codec codec);
/**
@ -87,6 +118,14 @@ public interface RedissonClient {
*/
<K, V> RMap<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> RMap<K, V> getMap(String name, Codec codec);
/**
@ -105,26 +144,54 @@ public interface RedissonClient {
*/
<V> RSet<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> RSet<V> getSet(String name, Codec codec);
/**
* Returns sorted set instance by name.
* This sorted set uses comparator to sort objects.
*
* @param name of sorted set
* @return
*/
<V> RSortedSet<V> getSortedSet(String name);
/**
* Returns sorted set instance by name
* using provided codec for sorted set objects.
* This sorted set sorts objects using comparator.
*
* @param name of sorted set
* @param sorted set object codec
* @return
*/
<V> RSortedSet<V> getSortedSet(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
*/
<V> RScoredSortedSet<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> RScoredSortedSet<V> getScoredSortedSet(String name, Codec codec);
/**
@ -145,6 +212,14 @@ public interface RedissonClient {
*/
<M> RTopic<M> getTopic(String name);
/**
* Returns topic instance by name
* using provided codec for messages.
*
* @param name of topic
* @param message codec
* @return
*/
<M> RTopic<M> getTopic(String name, Codec codec);
/**
@ -160,6 +235,19 @@ public interface RedissonClient {
*/
<M> RPatternTopic<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> RPatternTopic<M> getPatternTopic(String pattern, Codec codec);
/**
@ -170,6 +258,14 @@ public interface RedissonClient {
*/
<V> RQueue<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> RQueue<V> getQueue(String name, Codec codec);
/**
@ -180,6 +276,14 @@ public interface RedissonClient {
*/
<V> RBlockingQueue<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> RBlockingQueue<V> getBlockingQueue(String name, Codec codec);
/**
@ -190,24 +294,38 @@ public interface RedissonClient {
*/
<V> RDeque<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> RDeque<V> getDeque(String name, Codec codec);
/**
* Returns "atomic long" instance by name.
* Returns atomicLong instance by name.
*
* @param name of the "atomic long"
* @param name of atomicLong
* @return
*/
RAtomicLong getAtomicLong(String name);
/**
* Returns "count down latch" instance by name.
* Returns countDownLatch instance by name.
*
* @param name of the "count down latch"
* @param name of countDownLatch
* @return
*/
RCountDownLatch getCountDownLatch(String name);
/**
* Returns bitSet instance by name.
*
* @param name of bitSet
* @return
*/
RBitSet getBitSet(String name);
/**

@ -19,7 +19,7 @@ import org.redisson.client.protocol.Decoder;
import org.redisson.client.protocol.Encoder;
/**
* Redis code
* Redis codec interface
*
* @author Nikita Koksharov
*

@ -31,7 +31,7 @@ import io.netty.buffer.ByteBufInputStream;
/**
* Efficient and speedy serialization codec fully
* compatible with JDK codec.
* compatible with JDK Serialization codec.
*
* https://github.com/RuedigerMoeller/fast-serialization
*

@ -18,7 +18,6 @@ package org.redisson.codec;
import java.io.IOException;
import org.redisson.client.codec.Codec;
import org.redisson.client.codec.StringCodec;
import org.redisson.client.handler.State;
import org.redisson.client.protocol.Decoder;
import org.redisson.client.protocol.Encoder;
@ -39,6 +38,9 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
/**
*
* @see org.redisson.codec.CborJacksonCodec
* @see org.redisson.codec.MsgPackJacksonCodec
*
* @author Nikita Koksharov
*

Loading…
Cancel
Save