org.springframework.data.redis.connection
Interface RedisStringCommands

All Known Subinterfaces:
RedisCommands, RedisConnection, StringRedisConnection
All Known Implementing Classes:
DefaultStringRedisConnection, JedisConnection, JredisConnection, LettuceConnection, SrpConnection

public interface RedisStringCommands

String/Value-specific commands supported by Redis.


Nested Class Summary
static class RedisStringCommands.BitOperation
           
 
Method Summary
 Long append(byte[] key, byte[] value)
          Append a value to key.
 Long bitCount(byte[] key)
          Count the number of set bits (population counting) in value stored at key.
 Long bitCount(byte[] key, long begin, long end)
          Count the number of set bits (population counting) of value stored at key between begin and end.
 Long bitOp(RedisStringCommands.BitOperation op, byte[] destination, byte[]... keys)
          Perform bitwise operations between strings.
 Long decr(byte[] key)
          Decrement value of key by 1.
 Long decrBy(byte[] key, long value)
          Increment value of key by value.
 byte[] get(byte[] key)
          Get the value of key.
 Boolean getBit(byte[] key, long offset)
          Get the bit value at offset of value at key.
 byte[] getRange(byte[] key, long begin, long end)
          Get a substring of value of key between begin and end.
 byte[] getSet(byte[] key, byte[] value)
          Set value of key and return its old value.
 Long incr(byte[] key)
          Increment value of key by 1.
 Double incrBy(byte[] key, double value)
          Increment value of key by value.
 Long incrBy(byte[] key, long value)
          Increment value of key by value.
 List<byte[]> mGet(byte[]... keys)
          Get the values of all given keys.
 void mSet(Map<byte[],byte[]> tuple)
          Set multiple keys to multiple values using key-value pairs provided in tuple.
 Boolean mSetNX(Map<byte[],byte[]> tuple)
          Set multiple keys to multiple values using key-value pairs provided in tuple only if the provided key does not exist.
 void pSetEx(byte[] key, long milliseconds, byte[] value)
          Set the value and expiration in milliseconds for key.
 void set(byte[] key, byte[] value)
          Set value for key.
 Boolean setBit(byte[] key, long offset, boolean value)
          Sets the bit at offset in value stored at key.
 void setEx(byte[] key, long seconds, byte[] value)
          Set the value and expiration in seconds for key.
 Boolean setNX(byte[] key, byte[] value)
          Set value for key, only if key does not exist.
 void setRange(byte[] key, byte[] value, long offset)
          Overwrite parts of key starting at the specified offset with given value.
 Long strLen(byte[] key)
          Get the length of the value stored at key.
 

Method Detail

get

byte[] get(byte[] key)
Get the value of key.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/get

getSet

byte[] getSet(byte[] key,
              byte[] value)
Set value of key and return its old value.

Parameters:
key -
value -
Returns:
See Also:
http://redis.io/commands/getset

mGet

List<byte[]> mGet(byte[]... keys)
Get the values of all given keys.

Parameters:
keys -
Returns:
See Also:
http://redis.io/commands/mget

set

void set(byte[] key,
         byte[] value)
Set value for key.

Parameters:
key -
value -
See Also:
http://redis.io/commands/set

setNX

Boolean setNX(byte[] key,
              byte[] value)
Set value for key, only if key does not exist.

Parameters:
key -
value -
Returns:
See Also:
http://redis.io/commands/setnx

setEx

void setEx(byte[] key,
           long seconds,
           byte[] value)
Set the value and expiration in seconds for key.

Parameters:
key -
seconds -
value -
See Also:
http://redis.io/commands/setex

pSetEx

void pSetEx(byte[] key,
            long milliseconds,
            byte[] value)
Set the value and expiration in milliseconds for key.

Parameters:
key -
milliseconds -
value -
Since:
1.3
See Also:
http://redis.io/commands/psetex

mSet

void mSet(Map<byte[],byte[]> tuple)
Set multiple keys to multiple values using key-value pairs provided in tuple.

Parameters:
tuple -
See Also:
http://redis.io/commands/mset

mSetNX

Boolean mSetNX(Map<byte[],byte[]> tuple)
Set multiple keys to multiple values using key-value pairs provided in tuple only if the provided key does not exist.

Parameters:
tuple -
See Also:
http://redis.io/commands/msetnx

incr

Long incr(byte[] key)
Increment value of key by 1.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/incr

incrBy

Long incrBy(byte[] key,
            long value)
Increment value of key by value.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/incrby

incrBy

Double incrBy(byte[] key,
              double value)
Increment value of key by value.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/incrbyfloat

decr

Long decr(byte[] key)
Decrement value of key by 1.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/decr

decrBy

Long decrBy(byte[] key,
            long value)
Increment value of key by value.

Parameters:
key -
value -
Returns:
See Also:
http://redis.io/commands/decrby

append

Long append(byte[] key,
            byte[] value)
Append a value to key.

Parameters:
key -
value -
Returns:
See Also:
http://redis.io/commands/append

getRange

byte[] getRange(byte[] key,
                long begin,
                long end)
Get a substring of value of key between begin and end.

Parameters:
key -
begin -
end -
Returns:
See Also:
http://redis.io/commands/getrange

setRange

void setRange(byte[] key,
              byte[] value,
              long offset)
Overwrite parts of key starting at the specified offset with given value.

Parameters:
key -
value -
offset -
See Also:
http://redis.io/commands/setrange

getBit

Boolean getBit(byte[] key,
               long offset)
Get the bit value at offset of value at key.

Parameters:
key -
offset -
Returns:
See Also:
http://redis.io/commands/getbit

setBit

Boolean setBit(byte[] key,
               long offset,
               boolean value)
Sets the bit at offset in value stored at key.

Parameters:
key -
offset -
value -
Returns:
the original bit value stored at offset.
See Also:
http://redis.io/commands/setbit

bitCount

Long bitCount(byte[] key)
Count the number of set bits (population counting) in value stored at key.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/bitcount

bitCount

Long bitCount(byte[] key,
              long begin,
              long end)
Count the number of set bits (population counting) of value stored at key between begin and end.

Parameters:
key -
begin -
end -
Returns:
See Also:
http://redis.io/commands/bitcount

bitOp

Long bitOp(RedisStringCommands.BitOperation op,
           byte[] destination,
           byte[]... keys)
Perform bitwise operations between strings.

Parameters:
op -
destination -
keys -
Returns:
See Also:
http://redis.io/commands/bitop

strLen

Long strLen(byte[] key)
Get the length of the value stored at key.

Parameters:
key -
Returns:
See Also:
http://redis.io/commands/strlen