Interface BoundKeyOperations<K>
- All Known Subinterfaces:
BoundGeoOperations<K,,M> 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,RedisAtomicDouble,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.
- Author:
- Costin Leau, Christoph Strobl, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionSets the key time-to-live/expiration.default BooleanSets the key time-to-live/expiration.default BooleanSets the key time-to-live/expiration.Sets the key time-to-live/expiration.Returns the expiration of this key.getKey()Returns the key associated with this entity.getType()Returns the associated Redis type.persist()Removes the expiration (if any) of the key.voidRenames the key.
-
Method Details
-
getKey
K getKey()Returns the key associated with this entity.- Returns:
- key associated with the implementing entity
-
getType
Returns the associated Redis type.- Returns:
- key type. null when used in pipeline / transaction.
-
getExpire
Returns the expiration of this key.- Returns:
- expiration value (in seconds). null when used in pipeline / transaction.
-
expire
Sets the key time-to-live/expiration.- Parameters:
timeout- must not be null.- Returns:
- true if expiration was set, false otherwise. null when used in pipeline / transaction.
- Throws:
IllegalArgumentException- if the timeout is null.- Since:
- 2.3
-
expire
Sets the key time-to-live/expiration.- Parameters:
timeout- expiration valueunit- expiration unit- Returns:
- true if expiration was set, false otherwise. null when used in pipeline / transaction.
-
expireAt
Sets the key time-to-live/expiration.- Parameters:
date- expiration date- Returns:
- true if expiration was set, false otherwise. null when used in pipeline / transaction.
-
expireAt
Sets the key time-to-live/expiration.- Parameters:
expireAt- expiration time.- Returns:
- true if expiration was set, false otherwise. null when used in pipeline / transaction.
- Throws:
IllegalArgumentException- if the instant is null or too large to represent as aDate.- Since:
- 2.3
-
persist
Removes the expiration (if any) of the key.- Returns:
- true if expiration was removed, false otherwise. null when used in pipeline / transaction.
-
rename
Renames the key.
Note: The new name for empty collections will be propagated on add of first element.- Parameters:
newKey- new key. Must not be null.
-