org.springframework.data.redis.connection
Interface RedisKeyCommands

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

public interface RedisKeyCommands

Key-specific commands supported by Redis.


Method Summary
 Long del(byte[]... keys)
          Delete given keys.
 byte[] dump(byte[] key)
          Retrieve serialized version of the value stored at key.
 Boolean exists(byte[] key)
          Determine if given key exists.
 Boolean expire(byte[] key, long seconds)
          Set time to live for given key in seconds.
 Boolean expireAt(byte[] key, long unixTime)
          Set the expiration for given key as a UNIX timestamp.
 Set<byte[]> keys(byte[] pattern)
          Find all keys matching the given pattern.
 Boolean move(byte[] key, int dbIndex)
          Move given key to database with index.
 Boolean persist(byte[] key)
          Remove the expiration from given key.
 Boolean pExpire(byte[] key, long millis)
          Set time to live for given key in milliseconds.
 Boolean pExpireAt(byte[] key, long unixTimeInMillis)
          Set the expiration for given key as a UNIX timestamp in milliseconds.
 Long pTtl(byte[] key)
          Get the time to live for key in milliseconds.
 byte[] randomKey()
          Return a random key from the keyspace.
 void rename(byte[] oldName, byte[] newName)
          Rename key oleName to newName.
 Boolean renameNX(byte[] oldName, byte[] newName)
          Rename key oleName to newName only if newName does not exist.
 void restore(byte[] key, long ttlInMillis, byte[] serializedValue)
          Create key using the serializedValue, previously obtained using dump(byte[]).
 List<byte[]> sort(byte[] key, SortParameters params)
          Sort the elements for key.
 Long sort(byte[] key, SortParameters params, byte[] storeKey)
          Sort the elements for key and store result in storeKey.
 Long ttl(byte[] key)
          Get the time to live for key in seconds.
 DataType type(byte[] key)
          Determine the type stored at key.
 

Method Detail

exists

Boolean exists(byte[] key)
Determine if given key exists.

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

del

Long del(byte[]... keys)
Delete given keys.

Parameters:
keys -
Returns:
The number of keys that were removed.
See Also:
http://redis.io/commands/del

type

DataType type(byte[] key)
Determine the type stored at key.

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

keys

Set<byte[]> keys(byte[] pattern)
Find all keys matching the given pattern.

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

randomKey

byte[] randomKey()
Return a random key from the keyspace.

Returns:
See Also:
http://redis.io/commands/randomkey

rename

void rename(byte[] oldName,
            byte[] newName)
Rename key oleName to newName.

Parameters:
oldName -
newName -
See Also:
http://redis.io/commands/rename

renameNX

Boolean renameNX(byte[] oldName,
                 byte[] newName)
Rename key oleName to newName only if newName does not exist.

Parameters:
oldName -
newName -
Returns:
See Also:
http://redis.io/commands/renamenx

expire

Boolean expire(byte[] key,
               long seconds)
Set time to live for given key in seconds.

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

pExpire

Boolean pExpire(byte[] key,
                long millis)
Set time to live for given key in milliseconds.

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

expireAt

Boolean expireAt(byte[] key,
                 long unixTime)
Set the expiration for given key as a UNIX timestamp.

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

pExpireAt

Boolean pExpireAt(byte[] key,
                  long unixTimeInMillis)
Set the expiration for given key as a UNIX timestamp in milliseconds.

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

persist

Boolean persist(byte[] key)
Remove the expiration from given key.

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

move

Boolean move(byte[] key,
             int dbIndex)
Move given key to database with index.

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

ttl

Long ttl(byte[] key)
Get the time to live for key in seconds.

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

pTtl

Long pTtl(byte[] key)
Get the time to live for key in milliseconds.

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

sort

List<byte[]> sort(byte[] key,
                  SortParameters params)
Sort the elements for key.

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

sort

Long sort(byte[] key,
          SortParameters params,
          byte[] storeKey)
Sort the elements for key and store result in storeKey.

Parameters:
key -
params -
storeKey -
Returns:
See Also:
http://redis.io/commands/sort

dump

byte[] dump(byte[] key)
Retrieve serialized version of the value stored at key.

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

restore

void restore(byte[] key,
             long ttlInMillis,
             byte[] serializedValue)
Create key using the serializedValue, previously obtained using dump(byte[]).

Parameters:
key -
ttlInMillis -
serializedValue -
See Also:
http://redis.io/commands/restore