Spring Data Key-Value

org.springframework.data.keyvalue.redis.connection
Class DefaultStringRedisConnection

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

public class DefaultStringRedisConnection
extends Object
implements StringRedisConnection

Default implementation of StringRedisConnection.

Author:
Costin Leau

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

Constructor Detail

DefaultStringRedisConnection

public DefaultStringRedisConnection(RedisConnection connection)
Constructs a new DefaultStringRedisConnection instance. Uses StringRedisSerializer as underlying serializer.

Parameters:
connection - Redis connection

DefaultStringRedisConnection

public DefaultStringRedisConnection(RedisConnection connection,
                                    RedisSerializer<String> serializer)
Constructs a new DefaultStringRedisConnection instance.

Parameters:
connection - Redis connection
serializer - String serializer
Method Detail

append

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

bgSave

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

bgWriteAof

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

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

bRPopLPush

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

close

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

Specified by:
close in interface RedisConnection
Throws:
UncategorizedRedisException

dbSize

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

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

del

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

discard

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

echo

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

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

flushAll

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

flushDb

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

get

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

getBit

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

getConfig

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

getNativeConnection

public Object 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

getRange

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

getSet

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

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

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[]> hashes)
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

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

info

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

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

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

keys

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

lastSave

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

lIndex

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

lInsert

public Long lInsert(byte[] key,
                    RedisListCommands.Position where,
                    byte[] pivot,
                    byte[] value)
Specified by:
lInsert 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

lPushX

public Long lPushX(byte[] key,
                   byte[] value)
Specified by:
lPushX 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

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

multi

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

persist

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

ping

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

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

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

resetConfigStats

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

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

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

save

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

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

select

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

set

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

setBit

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

setConfig

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

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

setRange

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

shutdown

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

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

sort

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

sort

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

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

strLen

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

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

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

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

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

zRangeByScore

public Set<byte[]> zRangeByScore(byte[] key,
                                 double min,
                                 double max,
                                 long offset,
                                 long count)
Specified by:
zRangeByScore 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,
                                                           long offset,
                                                           long count)
Specified by:
zRangeByScoreWithScore in interface RedisZSetCommands

zRangeByScoreWithScore

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

zRangeWithScore

public Set<RedisZSetCommands.Tuple> zRangeWithScore(byte[] key,
                                                    long start,
                                                    long end)
Specified by:
zRangeWithScore 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

append

public Long append(String key,
                   String value)
Specified by:
append in interface StringRedisConnection

bLPop

public List<String> bLPop(int timeout,
                          String... keys)
Specified by:
bLPop in interface StringRedisConnection

bRPop

public List<String> bRPop(int timeout,
                          String... keys)
Specified by:
bRPop in interface StringRedisConnection

bRPopLPush

public String bRPopLPush(int timeout,
                         String srcKey,
                         String dstKey)
Specified by:
bRPopLPush in interface StringRedisConnection

decr

public Long decr(String key)
Specified by:
decr in interface StringRedisConnection

decrBy

public Long decrBy(String key,
                   long value)
Specified by:
decrBy in interface StringRedisConnection

del

public Long del(String... keys)
Specified by:
del in interface StringRedisConnection

echo

public String echo(String message)
Specified by:
echo in interface StringRedisConnection

exists

public Boolean exists(String key)
Specified by:
exists in interface StringRedisConnection

expire

public Boolean expire(String key,
                      long seconds)
Specified by:
expire in interface StringRedisConnection

expireAt

public Boolean expireAt(String key,
                        long unixTime)
Specified by:
expireAt in interface StringRedisConnection

get

public String get(String key)
Specified by:
get in interface StringRedisConnection

getBit

public Boolean getBit(String key,
                      long offset)
Specified by:
getBit in interface StringRedisConnection

getRange

public String getRange(String key,
                       int start,
                       int end)
Specified by:
getRange in interface StringRedisConnection

getSet

public String getSet(String key,
                     String value)
Specified by:
getSet in interface StringRedisConnection

hDel

public Boolean hDel(String key,
                    String field)
Specified by:
hDel in interface StringRedisConnection

hExists

public Boolean hExists(String key,
                       String field)
Specified by:
hExists in interface StringRedisConnection

hGet

public String hGet(String key,
                   String field)
Specified by:
hGet in interface StringRedisConnection

hGetAll

public Map<String,String> hGetAll(String key)
Specified by:
hGetAll in interface StringRedisConnection

hIncrBy

public Long hIncrBy(String key,
                    String field,
                    long delta)
Specified by:
hIncrBy in interface StringRedisConnection

hKeys

public Set<String> hKeys(String key)
Specified by:
hKeys in interface StringRedisConnection

hLen

public Long hLen(String key)
Specified by:
hLen in interface StringRedisConnection

hMGet

public List<String> hMGet(String key,
                          String... fields)
Specified by:
hMGet in interface StringRedisConnection

hMSet

public void hMSet(String key,
                  Map<String,String> hashes)
Specified by:
hMSet in interface StringRedisConnection

hSet

public Boolean hSet(String key,
                    String field,
                    String value)
Specified by:
hSet in interface StringRedisConnection

hSetNX

public Boolean hSetNX(String key,
                      String field,
                      String value)
Specified by:
hSetNX in interface StringRedisConnection

hVals

public List<String> hVals(String key)
Specified by:
hVals in interface StringRedisConnection

incr

public Long incr(String key)
Specified by:
incr in interface StringRedisConnection

incrBy

public Long incrBy(String key,
                   long value)
Specified by:
incrBy in interface StringRedisConnection

keys

public Collection<String> keys(String pattern)
Specified by:
keys in interface StringRedisConnection

lIndex

public String lIndex(String key,
                     long index)
Specified by:
lIndex in interface StringRedisConnection

lInsert

public Long lInsert(String key,
                    RedisListCommands.Position where,
                    String pivot,
                    String value)
Specified by:
lInsert in interface StringRedisConnection

lLen

public Long lLen(String key)
Specified by:
lLen in interface StringRedisConnection

lPop

public String lPop(String key)
Specified by:
lPop in interface StringRedisConnection

lPush

public Long lPush(String key,
                  String value)
Specified by:
lPush in interface StringRedisConnection

lPushX

public Long lPushX(String key,
                   String value)
Specified by:
lPushX in interface StringRedisConnection

lRange

public List<String> lRange(String key,
                           long start,
                           long end)
Specified by:
lRange in interface StringRedisConnection

lRem

public Long lRem(String key,
                 long count,
                 String value)
Specified by:
lRem in interface StringRedisConnection

lSet

public void lSet(String key,
                 long index,
                 String value)
Specified by:
lSet in interface StringRedisConnection

lTrim

public void lTrim(String key,
                  long start,
                  long end)
Specified by:
lTrim in interface StringRedisConnection

mGet

public List<String> mGet(String... keys)
Specified by:
mGet in interface StringRedisConnection

mSetNXString

public void mSetNXString(Map<String,String> tuple)
Specified by:
mSetNXString in interface StringRedisConnection

mSetString

public void mSetString(Map<String,String> tuple)
Specified by:
mSetString in interface StringRedisConnection

persist

public Boolean persist(String key)
Specified by:
persist in interface StringRedisConnection

pSubscribe

public void pSubscribe(MessageListener listener,
                       String... patterns)
Specified by:
pSubscribe in interface StringRedisConnection

publish

public Long publish(String channel,
                    String message)
Specified by:
publish in interface StringRedisConnection

rename

public void rename(String oldName,
                   String newName)
Specified by:
rename in interface StringRedisConnection

renameNX

public Boolean renameNX(String oldName,
                        String newName)
Specified by:
renameNX in interface StringRedisConnection

rPop

public String rPop(String key)
Specified by:
rPop in interface StringRedisConnection

rPopLPush

public String rPopLPush(String srcKey,
                        String dstKey)
Specified by:
rPopLPush in interface StringRedisConnection

rPush

public Long rPush(String key,
                  String value)
Specified by:
rPush in interface StringRedisConnection

rPushX

public Long rPushX(String key,
                   String value)
Specified by:
rPushX in interface StringRedisConnection

sAdd

public Boolean sAdd(String key,
                    String value)
Specified by:
sAdd in interface StringRedisConnection

sCard

public Long sCard(String key)
Specified by:
sCard in interface StringRedisConnection

sDiff

public Set<String> sDiff(String... keys)
Specified by:
sDiff in interface StringRedisConnection

sDiffStore

public void sDiffStore(String destKey,
                       String... keys)
Specified by:
sDiffStore in interface StringRedisConnection

set

public void set(String key,
                String value)
Specified by:
set in interface StringRedisConnection

setBit

public void setBit(String key,
                   long offset,
                   boolean value)
Specified by:
setBit in interface StringRedisConnection

setEx

public void setEx(String key,
                  long seconds,
                  String value)
Specified by:
setEx in interface StringRedisConnection

setNX

public Boolean setNX(String key,
                     String value)
Specified by:
setNX in interface StringRedisConnection

setRange

public void setRange(String key,
                     int start,
                     int end)
Specified by:
setRange in interface StringRedisConnection

sInter

public Set<String> sInter(String... keys)
Specified by:
sInter in interface StringRedisConnection

sInterStore

public void sInterStore(String destKey,
                        String... keys)
Specified by:
sInterStore in interface StringRedisConnection

sIsMember

public Boolean sIsMember(String key,
                         String value)
Specified by:
sIsMember in interface StringRedisConnection

sMembers

public Set<String> sMembers(String key)
Specified by:
sMembers in interface StringRedisConnection

sMove

public Boolean sMove(String srcKey,
                     String destKey,
                     String value)
Specified by:
sMove in interface StringRedisConnection

sort

public Long sort(String key,
                 SortParameters params,
                 String storeKey)
Specified by:
sort in interface StringRedisConnection

sort

public List<String> sort(String key,
                         SortParameters params)
Specified by:
sort in interface StringRedisConnection

sPop

public String sPop(String key)
Specified by:
sPop in interface StringRedisConnection

sRandMember

public String sRandMember(String key)
Specified by:
sRandMember in interface StringRedisConnection

sRem

public Boolean sRem(String key,
                    String value)
Specified by:
sRem in interface StringRedisConnection

strLen

public Long strLen(String key)
Specified by:
strLen in interface StringRedisConnection

subscribe

public void subscribe(MessageListener listener,
                      String... channels)
Specified by:
subscribe in interface StringRedisConnection

sUnion

public Set<String> sUnion(String... keys)
Specified by:
sUnion in interface StringRedisConnection

sUnionStore

public void sUnionStore(String destKey,
                        String... keys)
Specified by:
sUnionStore in interface StringRedisConnection

ttl

public Long ttl(String key)
Specified by:
ttl in interface StringRedisConnection

type

public DataType type(String key)
Specified by:
type in interface StringRedisConnection

zAdd

public Boolean zAdd(String key,
                    double score,
                    String value)
Specified by:
zAdd in interface StringRedisConnection

zCard

public Long zCard(String key)
Specified by:
zCard in interface StringRedisConnection

zCount

public Long zCount(String key,
                   double min,
                   double max)
Specified by:
zCount in interface StringRedisConnection

zIncrBy

public Double zIncrBy(String key,
                      double increment,
                      String value)
Specified by:
zIncrBy in interface StringRedisConnection

zInterStore

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

zInterStore

public Long zInterStore(String destKey,
                        String... sets)
Specified by:
zInterStore in interface StringRedisConnection

zRange

public Set<String> zRange(String key,
                          long start,
                          long end)
Specified by:
zRange in interface StringRedisConnection

zRangeByScore

public Set<String> zRangeByScore(String key,
                                 double min,
                                 double max,
                                 long offset,
                                 long count)
Specified by:
zRangeByScore in interface StringRedisConnection

zRangeByScore

public Set<String> zRangeByScore(String key,
                                 double min,
                                 double max)
Specified by:
zRangeByScore in interface StringRedisConnection

zRangeByScoreWithScore

public Set<StringRedisConnection.StringTuple> zRangeByScoreWithScore(String key,
                                                                     double min,
                                                                     double max,
                                                                     long offset,
                                                                     long count)
Specified by:
zRangeByScoreWithScore in interface StringRedisConnection

zRangeByScoreWithScore

public Set<StringRedisConnection.StringTuple> zRangeByScoreWithScore(String key,
                                                                     double min,
                                                                     double max)
Specified by:
zRangeByScoreWithScore in interface StringRedisConnection

zRangeWithScore

public Set<StringRedisConnection.StringTuple> zRangeWithScore(String key,
                                                              long start,
                                                              long end)
Specified by:
zRangeWithScore in interface StringRedisConnection

zRank

public Long zRank(String key,
                  String value)
Specified by:
zRank in interface StringRedisConnection

zRem

public Boolean zRem(String key,
                    String value)
Specified by:
zRem in interface StringRedisConnection

zRemRange

public Long zRemRange(String key,
                      long start,
                      long end)
Specified by:
zRemRange in interface StringRedisConnection

zRemRangeByScore

public Long zRemRangeByScore(String key,
                             double min,
                             double max)
Specified by:
zRemRangeByScore in interface StringRedisConnection

zRevRange

public Set<String> zRevRange(String key,
                             long start,
                             long end)
Specified by:
zRevRange in interface StringRedisConnection

zRevRangeWithScore

public Set<StringRedisConnection.StringTuple> zRevRangeWithScore(String key,
                                                                 long start,
                                                                 long end)
Specified by:
zRevRangeWithScore in interface StringRedisConnection

zRevRank

public Long zRevRank(String key,
                     String value)
Specified by:
zRevRank in interface StringRedisConnection

zScore

public Double zScore(String key,
                     String value)
Specified by:
zScore in interface StringRedisConnection

zUnionStore

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

zUnionStore

public Long zUnionStore(String destKey,
                        String... sets)
Specified by:
zUnionStore in interface StringRedisConnection

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.

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()

Spring Data Key-Value

Copyright © 2010-2011 SpringSource. All Rights Reserved.