org.springframework.data.redis.core
Interface BoundKeyOperations<K>

All Known Subinterfaces:
BoundHashOperations<H,HK,HV>, BoundListOperations<K,V>, BoundSetOperations<K,V>, BoundValueOperations<K,V>, BoundZSetOperations<K,V>, RedisCollection<E>, RedisList<E>, RedisMap<K,V>, RedisSet<E>, RedisStore, RedisZSet<E>
All Known Implementing Classes:
AbstractRedisCollection, DefaultRedisList, DefaultRedisMap, DefaultRedisSet, DefaultRedisZSet, RedisAtomicInteger, RedisAtomicLong, RedisProperties

public interface BoundKeyOperations<K>

Operations over a Redis key. Useful for executing common key-'bound' operations to all implementations.

As the rest of the APIs, if the underlying connection is pipelined or queued/in multi mode, all methods will return null.


Method Summary
 Boolean expire(long timeout, TimeUnit unit)
          Sets the key time-to-live/expiration.
 Boolean expireAt(Date date)
          Sets the key time-to-live/expiration.
 Long getExpire()
          Returns the expiration of this key.
 K getKey()
          Returns the key associated with this entity.
 DataType getType()
          Returns the associated Redis type.
 Boolean persist()
          Removes the expiration (if any) of the key.
 void rename(K newKey)
          Renames the key.
 

Method Detail

getKey

K getKey()
Returns the key associated with this entity.

Returns:
key associated with the implementing entity

getType

DataType getType()
Returns the associated Redis type.

Returns:
key type

getExpire

Long getExpire()
Returns the expiration of this key.

Returns:
expiration value (in seconds)

expire

Boolean expire(long timeout,
               TimeUnit unit)
Sets the key time-to-live/expiration.

Parameters:
timeout - expiration value
unit - expiration unit
Returns:
true if expiration was set, false otherwise

expireAt

Boolean expireAt(Date date)
Sets the key time-to-live/expiration.

Parameters:
date - expiration date
Returns:
true if expiration was set, false otherwise

persist

Boolean persist()
Removes the expiration (if any) of the key.

Returns:
true if expiration was removed, false otherwise

rename

void rename(K newKey)
Renames the key.

Parameters:
newKey - new key