Spring Data Key-Value

org.springframework.data.keyvalue.redis.connection.jredis
Class JredisConnection

java.lang.Object
  extended by org.springframework.data.keyvalue.redis.connection.jredis.JredisConnection
All Implemented Interfaces:
RedisCommands, RedisConnection, RedisHashCommands, RedisListCommands, RedisPubSubCommands, RedisServerCommands, RedisSetCommands, RedisStringCommands, RedisTxCommands, RedisZSetCommands

public class JredisConnection
extends Object
implements RedisConnection

RedisConnection implementation on top of JRedis library.

Author:
Costin Leau

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.springframework.data.keyvalue.redis.connection.RedisListCommands
RedisListCommands.Position
 
Nested classes/interfaces inherited from interface org.springframework.data.keyvalue.redis.connection.RedisZSetCommands
RedisZSetCommands.Aggregate, RedisZSetCommands.Tuple
 
Constructor Summary
JredisConnection(org.jredis.JRedis jredis)
          Constructs a new JredisConnection instance.
 
Method Summary
 Long append(byte[] key, byte[] value)
           
 void bgSave()
           
 void bgWriteAof()
           
 List<byte[]> bLPop(int timeout, byte[]... keys)
           
 List<byte[]> bRPop(int timeout, byte[]... keys)
           
 byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey)
           
 void close()
          Closes (or quits) the connection.
 List<Object> closePipeline()
          Executes the commands in the pipeline and returns their result.
protected  DataAccessException convertJedisAccessException(Exception ex)
           
 Long dbSize()
           
 Long decr(byte[] key)
           
 Long decrBy(byte[] key, long value)
           
 Long del(byte[]... keys)
           
 void discard()
           
 byte[] echo(byte[] message)
           
 List<Object> exec()
           
 Boolean exists(byte[] key)
           
 Boolean expire(byte[] key, long seconds)
           
 Boolean expireAt(byte[] key, long unixTime)
           
 void flushAll()
           
 void flushDb()
           
 byte[] get(byte[] key)
           
 Boolean getBit(byte[] key, long offset)
           
 List<String> getConfig(String pattern)
           
 org.jredis.JRedis getNativeConnection()
          Returns the native connection (the underlying library/driver object).
 byte[] getRange(byte[] key, int start, int end)
           
 byte[] getSet(byte[] key, byte[] value)
           
 Subscription getSubscription()
          Returns the current subscription for this connection or null if the connection is not subscribed.
 Boolean hDel(byte[] key, byte[] field)
           
 Boolean hExists(byte[] key, byte[] field)
           
 byte[] hGet(byte[] key, byte[] field)
           
 Map<byte[],byte[]> hGetAll(byte[] key)
           
 Long hIncrBy(byte[] key, byte[] field, long delta)
           
 Set<byte[]> hKeys(byte[] key)
           
 Long hLen(byte[] key)
           
 List<byte[]> hMGet(byte[] key, byte[]... fields)
           
 void hMSet(byte[] key, Map<byte[],byte[]> values)
           
 Boolean hSet(byte[] key, byte[] field, byte[] value)
           
 Boolean hSetNX(byte[] key, byte[] field, byte[] value)
           
 List<byte[]> hVals(byte[] key)
           
 Long incr(byte[] key)
           
 Long incrBy(byte[] key, long value)
           
 Properties info()
           
 boolean isClosed()
          Indicates whether the underlying connection is closed or not.
 boolean isPipelined()
          Indicates whether the connection is currently pipelined or not.
 boolean isQueueing()
          Indicates whether the connection is in "queue"(or "MULTI") mode or not.
 boolean isSubscribed()
          Indicates whether the current connection is subscribed (to at least one channel) or not.
 Collection<byte[]> keys(byte[] pattern)
           
 Long lastSave()
           
 byte[] lIndex(byte[] key, long index)
           
 Long lInsert(byte[] key, RedisListCommands.Position where, byte[] pivot, byte[] value)
           
 Long lLen(byte[] key)
           
 byte[] lPop(byte[] key)
           
 Long lPush(byte[] key, byte[] value)
           
 Long lPushX(byte[] key, byte[] value)
           
 List<byte[]> lRange(byte[] key, long start, long end)
           
 Long lRem(byte[] key, long count, byte[] value)
           
 void lSet(byte[] key, long index, byte[] value)
           
 void lTrim(byte[] key, long start, long end)
           
 List<byte[]> mGet(byte[]... keys)
           
 void mSet(Map<byte[],byte[]> tuple)
           
 void mSetNX(Map<byte[],byte[]> tuple)
           
 void multi()
           
 void openPipeline()
          Activates the pipeline mode for this connection.
 Boolean persist(byte[] key)
           
 String ping()
           
 void pSubscribe(MessageListener listener, byte[]... patterns)
          Subscribes the connection to all channels matching the given patterns.
 Long publish(byte[] channel, byte[] message)
          Publishes the given message to the given channel.
 byte[] randomKey()
           
 void rename(byte[] oldName, byte[] newName)
           
 Boolean renameNX(byte[] oldName, byte[] newName)
           
 void resetConfigStats()
           
 byte[] rPop(byte[] key)
           
 byte[] rPopLPush(byte[] srcKey, byte[] dstKey)
           
 Long rPush(byte[] key, byte[] value)
           
 Long rPushX(byte[] key, byte[] value)
           
 Boolean sAdd(byte[] key, byte[] value)
           
 void save()
           
 Long sCard(byte[] key)
           
 Set<byte[]> sDiff(byte[]... keys)
           
 void sDiffStore(byte[] destKey, byte[]... keys)
           
 void select(int dbIndex)
           
 void set(byte[] key, byte[] value)
           
 void setBit(byte[] key, long offset, boolean value)
           
 void setConfig(String param, String value)
           
 void setEx(byte[] key, long seconds, byte[] value)
           
 Boolean setNX(byte[] key, byte[] value)
           
 void setRange(byte[] key, int start, int end)
           
 void shutdown()
           
 Set<byte[]> sInter(byte[]... keys)
           
 void sInterStore(byte[] destKey, byte[]... keys)
           
 Boolean sIsMember(byte[] key, byte[] value)
           
 Set<byte[]> sMembers(byte[] key)
           
 Boolean sMove(byte[] srcKey, byte[] destKey, byte[] value)
           
 List<byte[]> sort(byte[] key, SortParameters params)
           
 Long sort(byte[] key, SortParameters params, byte[] storeKey)
           
 byte[] sPop(byte[] key)
           
 byte[] sRandMember(byte[] key)
           
 Boolean sRem(byte[] key, byte[] value)
           
 Long strLen(byte[] key)
           
 void subscribe(MessageListener listener, byte[]... channels)
          Subscribes the connection to the given channels.
 Set<byte[]> sUnion(byte[]... keys)
           
 void sUnionStore(byte[] destKey, byte[]... keys)
           
 Long ttl(byte[] key)
           
 DataType type(byte[] key)
           
 void unwatch()
           
 void watch(byte[]... keys)
           
 Boolean zAdd(byte[] key, double score, byte[] value)
           
 Long zCard(byte[] key)
           
 Long zCount(byte[] key, double min, double max)
           
 Double zIncrBy(byte[] key, double increment, byte[] value)
           
 Long zInterStore(byte[] destKey, byte[]... sets)
           
 Long zInterStore(byte[] destKey, RedisZSetCommands.Aggregate aggregate, int[] weights, byte[]... sets)
           
 Set<byte[]> zRange(byte[] key, long start, long end)
           
 Set<byte[]> zRangeByScore(byte[] key, double min, double max)
           
 Set<byte[]> zRangeByScore(byte[] key, double min, double max, long offset, long count)
           
 Set<RedisZSetCommands.Tuple> zRangeByScoreWithScore(byte[] key, double min, double max)
           
 Set<RedisZSetCommands.Tuple> zRangeByScoreWithScore(byte[] key, double min, double max, long offset, long count)
           
 Set<RedisZSetCommands.Tuple> zRangeWithScore(byte[] key, long start, long end)
           
 Long zRank(byte[] key, byte[] value)
           
 Boolean zRem(byte[] key, byte[] value)
           
 Long zRemRange(byte[] key, long start, long end)
           
 Long zRemRangeByScore(byte[] key, double min, double max)
           
 Set<byte[]> zRevRange(byte[] key, long start, long end)
           
 Set<RedisZSetCommands.Tuple> zRevRangeWithScore(byte[] key, long start, long end)
           
 Long zRevRank(byte[] key, byte[] value)
           
 Double zScore(byte[] key, byte[] value)
           
 Long zUnionStore(byte[] destKey, byte[]... sets)
           
 Long zUnionStore(byte[] destKey, RedisZSetCommands.Aggregate aggregate, int[] weights, byte[]... sets)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JredisConnection

public JredisConnection(org.jredis.JRedis jredis)
Constructs a new JredisConnection instance.

Parameters:
jredis - JRedis connection
Method Detail

convertJedisAccessException

protected DataAccessException convertJedisAccessException(Exception ex)

close

public void close()
           throws UncategorizedRedisException
Description copied from interface: RedisConnection
Closes (or quits) the connection.

Specified by:
close in interface RedisConnection
Throws:
UncategorizedRedisException

getNativeConnection

public org.jredis.JRedis getNativeConnection()
Description copied from interface: RedisConnection
Returns the native connection (the underlying library/driver object).

Specified by:
getNativeConnection in interface RedisConnection
Returns:
underlying, native object

isClosed

public boolean isClosed()
Description copied from interface: RedisConnection
Indicates whether the underlying connection is closed or not.

Specified by:
isClosed in interface RedisConnection
Returns:
true if the connection is closed, false otherwise.

isQueueing

public boolean isQueueing()
Description copied from interface: RedisConnection
Indicates whether the connection is in "queue"(or "MULTI") mode or not. When queueing, all commands are postponed until EXEC or DISCARD commands are issued. Since in queueing no results are returned, the connection will return NULL on all operations that interact with the data.

Specified by:
isQueueing in interface RedisConnection
Returns:
true if the connection is in queue/MULTI mode, false otherwise

isPipelined

public boolean isPipelined()
Description copied from interface: RedisConnection
Indicates whether the connection is currently pipelined or not.

Specified by:
isPipelined in interface RedisConnection
Returns:
true if the connection is pipelined, false otherwise
See Also:
RedisConnection.openPipeline(), RedisConnection.isQueueing()

openPipeline

public void openPipeline()
Description copied from interface: RedisConnection
Activates the pipeline mode for this connection. When pipelined, all commands return null (the reply is read at the end through RedisConnection.closePipeline(). Calling this method when the connection is already pipelined has no effect. Pipelining is used for issuing commands without requesting the response right away but rather at the end of the batch. While somewhat similar to MULTI, pipelining does not guarantee atomicity - it only tries to improve performance when issuing a lot of commands (such as in batching scenarios).

Note:

Consider doing some performance testing before using this feature since in many cases the performance benefits are minimal yet the impact on usage are not.

Specified by:
openPipeline in interface RedisConnection
See Also:
RedisTxCommands.multi()

closePipeline

public List<Object> closePipeline()
Description copied from interface: RedisConnection
Executes the commands in the pipeline and returns their result. If the connection is not pipelined, an empty collection is returned.

Specified by:
closePipeline in interface RedisConnection
Returns:
the result of the executed commands.

sort

public List<byte[]> sort(byte[] key,
                         SortParameters params)
Specified by:
sort in interface RedisCommands

sort

public Long sort(byte[] key,
                 SortParameters params,
                 byte[] storeKey)
Specified by:
sort in interface RedisCommands

dbSize

public Long dbSize()
Specified by:
dbSize in interface RedisServerCommands

flushDb

public void flushDb()
Specified by:
flushDb in interface RedisServerCommands

flushAll

public void flushAll()
Specified by:
flushAll in interface RedisServerCommands

echo

public byte[] echo(byte[] message)
Specified by:
echo in interface RedisCommands

ping

public String ping()
Specified by:
ping in interface RedisCommands

bgSave

public void bgSave()
Specified by:
bgSave in interface RedisServerCommands

bgWriteAof

public void bgWriteAof()
Specified by:
bgWriteAof in interface RedisServerCommands

save

public void save()
Specified by:
save in interface RedisServerCommands

getConfig

public List<String> getConfig(String pattern)
Specified by:
getConfig in interface RedisServerCommands

info

public Properties info()
Specified by:
info in interface RedisServerCommands

lastSave

public Long lastSave()
Specified by:
lastSave in interface RedisServerCommands

setConfig

public void setConfig(String param,
                      String value)
Specified by:
setConfig in interface RedisServerCommands

resetConfigStats

public void resetConfigStats()
Specified by:
resetConfigStats in interface RedisServerCommands

shutdown

public void shutdown()
Specified by:
shutdown in interface RedisServerCommands

del

public Long del(byte[]... keys)
Specified by:
del in interface RedisCommands

discard

public void discard()
Specified by:
discard in interface RedisTxCommands

exec

public List<Object> exec()
Specified by:
exec in interface RedisTxCommands

exists

public Boolean exists(byte[] key)
Specified by:
exists in interface RedisCommands

expire

public Boolean expire(byte[] key,
                      long seconds)
Specified by:
expire in interface RedisCommands

expireAt

public Boolean expireAt(byte[] key,
                        long unixTime)
Specified by:
expireAt in interface RedisCommands

keys

public Collection<byte[]> keys(byte[] pattern)
Specified by:
keys in interface RedisCommands

multi

public void multi()
Specified by:
multi in interface RedisTxCommands

persist

public Boolean persist(byte[] key)
Specified by:
persist in interface RedisCommands

randomKey

public byte[] randomKey()
Specified by:
randomKey in interface RedisCommands

rename

public void rename(byte[] oldName,
                   byte[] newName)
Specified by:
rename in interface RedisCommands

renameNX

public Boolean renameNX(byte[] oldName,
                        byte[] newName)
Specified by:
renameNX in interface RedisCommands

select

public void select(int dbIndex)
Specified by:
select in interface RedisCommands

ttl

public Long ttl(byte[] key)
Specified by:
ttl in interface RedisCommands

type

public DataType type(byte[] key)
Specified by:
type in interface RedisCommands

unwatch

public void unwatch()
Specified by:
unwatch in interface RedisTxCommands

watch

public void watch(byte[]... keys)
Specified by:
watch in interface RedisTxCommands

get

public byte[] get(byte[] key)
Specified by:
get in interface RedisStringCommands

set

public void set(byte[] key,
                byte[] value)
Specified by:
set in interface RedisStringCommands

getSet

public byte[] getSet(byte[] key,
                     byte[] value)
Specified by:
getSet in interface RedisStringCommands

append

public Long append(byte[] key,
                   byte[] value)
Specified by:
append in interface RedisStringCommands

mGet

public List<byte[]> mGet(byte[]... keys)
Specified by:
mGet in interface RedisStringCommands

mSet

public void mSet(Map<byte[],byte[]> tuple)
Specified by:
mSet in interface RedisStringCommands

mSetNX

public void mSetNX(Map<byte[],byte[]> tuple)
Specified by:
mSetNX in interface RedisStringCommands

setEx

public void setEx(byte[] key,
                  long seconds,
                  byte[] value)
Specified by:
setEx in interface RedisStringCommands

setNX

public Boolean setNX(byte[] key,
                     byte[] value)
Specified by:
setNX in interface RedisStringCommands

getRange

public byte[] getRange(byte[] key,
                       int start,
                       int end)
Specified by:
getRange in interface RedisStringCommands

decr

public Long decr(byte[] key)
Specified by:
decr in interface RedisStringCommands

decrBy

public Long decrBy(byte[] key,
                   long value)
Specified by:
decrBy in interface RedisStringCommands

incr

public Long incr(byte[] key)
Specified by:
incr in interface RedisStringCommands

incrBy

public Long incrBy(byte[] key,
                   long value)
Specified by:
incrBy in interface RedisStringCommands

getBit

public Boolean getBit(byte[] key,
                      long offset)
Specified by:
getBit in interface RedisStringCommands

setBit

public void setBit(byte[] key,
                   long offset,
                   boolean value)
Specified by:
setBit in interface RedisStringCommands

setRange

public void setRange(byte[] key,
                     int start,
                     int end)
Specified by:
setRange in interface RedisStringCommands

strLen

public Long strLen(byte[] key)
Specified by:
strLen in interface RedisStringCommands

bLPop

public List<byte[]> bLPop(int timeout,
                          byte[]... keys)
Specified by:
bLPop in interface RedisListCommands

bRPop

public List<byte[]> bRPop(int timeout,
                          byte[]... keys)
Specified by:
bRPop in interface RedisListCommands

lIndex

public byte[] lIndex(byte[] key,
                     long index)
Specified by:
lIndex in interface RedisListCommands

lLen

public Long lLen(byte[] key)
Specified by:
lLen in interface RedisListCommands

lPop

public byte[] lPop(byte[] key)
Specified by:
lPop in interface RedisListCommands

lPush

public Long lPush(byte[] key,
                  byte[] value)
Specified by:
lPush in interface RedisListCommands

lRange

public List<byte[]> lRange(byte[] key,
                           long start,
                           long end)
Specified by:
lRange in interface RedisListCommands

lRem

public Long lRem(byte[] key,
                 long count,
                 byte[] value)
Specified by:
lRem in interface RedisListCommands

lSet

public void lSet(byte[] key,
                 long index,
                 byte[] value)
Specified by:
lSet in interface RedisListCommands

lTrim

public void lTrim(byte[] key,
                  long start,
                  long end)
Specified by:
lTrim in interface RedisListCommands

rPop

public byte[] rPop(byte[] key)
Specified by:
rPop in interface RedisListCommands

rPopLPush

public byte[] rPopLPush(byte[] srcKey,
                        byte[] dstKey)
Specified by:
rPopLPush in interface RedisListCommands

rPush

public Long rPush(byte[] key,
                  byte[] value)
Specified by:
rPush in interface RedisListCommands

lInsert

public Long lInsert(byte[] key,
                    RedisListCommands.Position where,
                    byte[] pivot,
                    byte[] value)
Specified by:
lInsert in interface RedisListCommands

bRPopLPush

public byte[] bRPopLPush(int timeout,
                         byte[] srcKey,
                         byte[] dstKey)
Specified by:
bRPopLPush in interface RedisListCommands

lPushX

public Long lPushX(byte[] key,
                   byte[] value)
Specified by:
lPushX in interface RedisListCommands

rPushX

public Long rPushX(byte[] key,
                   byte[] value)
Specified by:
rPushX in interface RedisListCommands

sAdd

public Boolean sAdd(byte[] key,
                    byte[] value)
Specified by:
sAdd in interface RedisSetCommands

sCard

public Long sCard(byte[] key)
Specified by:
sCard in interface RedisSetCommands

sDiff

public Set<byte[]> sDiff(byte[]... keys)
Specified by:
sDiff in interface RedisSetCommands

sDiffStore

public void sDiffStore(byte[] destKey,
                       byte[]... keys)
Specified by:
sDiffStore in interface RedisSetCommands

sInter

public Set<byte[]> sInter(byte[]... keys)
Specified by:
sInter in interface RedisSetCommands

sInterStore

public void sInterStore(byte[] destKey,
                        byte[]... keys)
Specified by:
sInterStore in interface RedisSetCommands

sIsMember

public Boolean sIsMember(byte[] key,
                         byte[] value)
Specified by:
sIsMember in interface RedisSetCommands

sMembers

public Set<byte[]> sMembers(byte[] key)
Specified by:
sMembers in interface RedisSetCommands

sMove

public Boolean sMove(byte[] srcKey,
                     byte[] destKey,
                     byte[] value)
Specified by:
sMove in interface RedisSetCommands

sPop

public byte[] sPop(byte[] key)
Specified by:
sPop in interface RedisSetCommands

sRandMember

public byte[] sRandMember(byte[] key)
Specified by:
sRandMember in interface RedisSetCommands

sRem

public Boolean sRem(byte[] key,
                    byte[] value)
Specified by:
sRem in interface RedisSetCommands

sUnion

public Set<byte[]> sUnion(byte[]... keys)
Specified by:
sUnion in interface RedisSetCommands

sUnionStore

public void sUnionStore(byte[] destKey,
                        byte[]... keys)
Specified by:
sUnionStore in interface RedisSetCommands

zAdd

public Boolean zAdd(byte[] key,
                    double score,
                    byte[] value)
Specified by:
zAdd in interface RedisZSetCommands

zCard

public Long zCard(byte[] key)
Specified by:
zCard in interface RedisZSetCommands

zCount

public Long zCount(byte[] key,
                   double min,
                   double max)
Specified by:
zCount in interface RedisZSetCommands

zIncrBy

public Double zIncrBy(byte[] key,
                      double increment,
                      byte[] value)
Specified by:
zIncrBy in interface RedisZSetCommands

zInterStore

public Long zInterStore(byte[] destKey,
                        RedisZSetCommands.Aggregate aggregate,
                        int[] weights,
                        byte[]... sets)
Specified by:
zInterStore in interface RedisZSetCommands

zInterStore

public Long zInterStore(byte[] destKey,
                        byte[]... sets)
Specified by:
zInterStore in interface RedisZSetCommands

zRange

public Set<byte[]> zRange(byte[] key,
                          long start,
                          long end)
Specified by:
zRange in interface RedisZSetCommands

zRangeWithScore

public Set<RedisZSetCommands.Tuple> zRangeWithScore(byte[] key,
                                                    long start,
                                                    long end)
Specified by:
zRangeWithScore in interface RedisZSetCommands

zRangeByScore

public Set<byte[]> zRangeByScore(byte[] key,
                                 double min,
                                 double max)
Specified by:
zRangeByScore in interface RedisZSetCommands

zRangeByScoreWithScore

public Set<RedisZSetCommands.Tuple> zRangeByScoreWithScore(byte[] key,
                                                           double min,
                                                           double max)
Specified by:
zRangeByScoreWithScore in interface RedisZSetCommands

zRangeByScore

public Set<byte[]> zRangeByScore(byte[] key,
                                 double min,
                                 double max,
                                 long offset,
                                 long count)
Specified by:
zRangeByScore in interface RedisZSetCommands

zRangeByScoreWithScore

public Set<RedisZSetCommands.Tuple> zRangeByScoreWithScore(byte[] key,
                                                           double min,
                                                           double max,
                                                           long offset,
                                                           long count)
Specified by:
zRangeByScoreWithScore in interface RedisZSetCommands

zRank

public Long zRank(byte[] key,
                  byte[] value)
Specified by:
zRank in interface RedisZSetCommands

zRem

public Boolean zRem(byte[] key,
                    byte[] value)
Specified by:
zRem in interface RedisZSetCommands

zRemRange

public Long zRemRange(byte[] key,
                      long start,
                      long end)
Specified by:
zRemRange in interface RedisZSetCommands

zRemRangeByScore

public Long zRemRangeByScore(byte[] key,
                             double min,
                             double max)
Specified by:
zRemRangeByScore in interface RedisZSetCommands

zRevRange

public Set<byte[]> zRevRange(byte[] key,
                             long start,
                             long end)
Specified by:
zRevRange in interface RedisZSetCommands

zRevRangeWithScore

public Set<RedisZSetCommands.Tuple> zRevRangeWithScore(byte[] key,
                                                       long start,
                                                       long end)
Specified by:
zRevRangeWithScore in interface RedisZSetCommands

zRevRank

public Long zRevRank(byte[] key,
                     byte[] value)
Specified by:
zRevRank in interface RedisZSetCommands

zScore

public Double zScore(byte[] key,
                     byte[] value)
Specified by:
zScore in interface RedisZSetCommands

zUnionStore

public Long zUnionStore(byte[] destKey,
                        RedisZSetCommands.Aggregate aggregate,
                        int[] weights,
                        byte[]... sets)
Specified by:
zUnionStore in interface RedisZSetCommands

zUnionStore

public Long zUnionStore(byte[] destKey,
                        byte[]... sets)
Specified by:
zUnionStore in interface RedisZSetCommands

hDel

public Boolean hDel(byte[] key,
                    byte[] field)
Specified by:
hDel in interface RedisHashCommands

hExists

public Boolean hExists(byte[] key,
                       byte[] field)
Specified by:
hExists in interface RedisHashCommands

hGet

public byte[] hGet(byte[] key,
                   byte[] field)
Specified by:
hGet in interface RedisHashCommands

hGetAll

public Map<byte[],byte[]> hGetAll(byte[] key)
Specified by:
hGetAll in interface RedisHashCommands

hIncrBy

public Long hIncrBy(byte[] key,
                    byte[] field,
                    long delta)
Specified by:
hIncrBy in interface RedisHashCommands

hKeys

public Set<byte[]> hKeys(byte[] key)
Specified by:
hKeys in interface RedisHashCommands

hLen

public Long hLen(byte[] key)
Specified by:
hLen in interface RedisHashCommands

hMGet

public List<byte[]> hMGet(byte[] key,
                          byte[]... fields)
Specified by:
hMGet in interface RedisHashCommands

hMSet

public void hMSet(byte[] key,
                  Map<byte[],byte[]> values)
Specified by:
hMSet in interface RedisHashCommands

hSet

public Boolean hSet(byte[] key,
                    byte[] field,
                    byte[] value)
Specified by:
hSet in interface RedisHashCommands

hSetNX

public Boolean hSetNX(byte[] key,
                      byte[] field,
                      byte[] value)
Specified by:
hSetNX in interface RedisHashCommands

hVals

public List<byte[]> hVals(byte[] key)
Specified by:
hVals in interface RedisHashCommands

getSubscription

public Subscription getSubscription()
Description copied from interface: RedisPubSubCommands
Returns the current subscription for this connection or null if the connection is not subscribed.

Specified by:
getSubscription in interface RedisPubSubCommands
Returns:
the current subscription, null if none is available

isSubscribed

public boolean isSubscribed()
Description copied from interface: RedisPubSubCommands
Indicates whether the current connection is subscribed (to at least one channel) or not.

Specified by:
isSubscribed in interface RedisPubSubCommands
Returns:
true if the connection is subscribed, false otherwise

pSubscribe

public void pSubscribe(MessageListener listener,
                       byte[]... patterns)
Description copied from interface: RedisPubSubCommands
Subscribes the connection to all channels matching the given patterns. Once subscribed, a connection enters listening mode and can only subscribe to other channels or unsubscribe. No other commands are accepted until the connection is unsubscribed.

Note that this operation is blocking and the current thread starts waiting for new messages immediately.

Specified by:
pSubscribe in interface RedisPubSubCommands
Parameters:
listener - message listener
patterns - channel name patterns

publish

public Long publish(byte[] channel,
                    byte[] message)
Description copied from interface: RedisPubSubCommands
Publishes the given message to the given channel.

Specified by:
publish in interface RedisPubSubCommands
Parameters:
channel - the channel to publish to
message - message to publish
Returns:
the number of clients that received the message

subscribe

public void subscribe(MessageListener listener,
                      byte[]... channels)
Description copied from interface: RedisPubSubCommands
Subscribes the connection to the given channels. Once subscribed, a connection enters listening mode and can only subscribe to other channels or unsubscribe. No other commands are accepted until the connection is unsubscribed.

Note that this operation is blocking and the current thread starts waiting for new messages immediately.

Specified by:
subscribe in interface RedisPubSubCommands
Parameters:
listener - message listener
channels - channel names

Spring Data Key-Value

Copyright © 2010-2011 SpringSource. All Rights Reserved.