Class RedisProperties
java.lang.Object
java.util.Dictionary<K,V>
java.util.Hashtable<Object,Object>
java.util.Properties
org.springframework.data.redis.support.collections.RedisProperties
- All Implemented Interfaces:
Serializable,Cloneable,ConcurrentMap<Object,,Object> Map<Object,,Object> BoundKeyOperations<String>,RedisMap<Object,,Object> RedisStore
Properties extension for a Redis back-store. Useful for reading (and storing) properties inside a Redis hash.
Particularly useful inside a Spring container for hooking into Spring's property placeholder or
PropertiesFactoryBean.
Note that this implementation only accepts Strings - objects of other type are not supported.
- Author:
- Costin Leau
- See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class java.util.Properties
defaults -
Constructor Summary
ConstructorsConstructorDescriptionRedisProperties(String key, RedisOperations<String, ?> operations) Constructs a newRedisPropertiesinstance.RedisProperties(Properties defaults, String key, RedisOperations<String, ?> operations) Constructs a newRedisPropertiesinstance.RedisProperties(Properties defaults, BoundHashOperations<String, String, String> boundOps) Constructs a newRedisPropertiesinstance.RedisProperties(BoundHashOperations<String, String, String> boundOps) Constructs a newRedisPropertiesinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()clone()booleanbooleancontainsKey(Object key) booleancontainsValue(Object value) elements()entrySet()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.Returns the underlying Redis operations used by the backing implementation.getType()Returns the associated Redis type.inthashCode()Returns a bound operations object to perform operations on the hash field expiration for all hash fields at the boundBoundKeyOperations.getKey().hashFieldExpiration(Collection<Object> hashFields) Returns a bound operations object to perform operations on the hash field expiration for all hash fields at the boundBoundKeyOperations.getKey()for the given hash fields.Incrementvalueof the hashkeyby the givendelta.Incrementvalueof the hashkeyby the givendelta.booleanisEmpty()keys()keySet()persist()Removes the expiration (if any) of the key.Enumeration<?>voidputIfAbsent(Object key, Object value) Get a random entry from the hash.Get a random key from the hash.booleanvoidRenames the key.booleanscan()intsize()voidstoreToXML(OutputStream os, String comment) voidstoreToXML(OutputStream os, String comment, String encoding) values()Methods inherited from class java.util.Properties
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, getProperty, getProperty, list, list, load, load, loadFromXML, merge, rehash, replaceAll, save, setProperty, store, store, storeToXML, stringPropertyNames, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.data.redis.core.BoundKeyOperations
expiration, expire, expireAtMethods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAllMethods inherited from interface org.springframework.data.redis.support.collections.RedisMap
hashFieldExpiration
-
Constructor Details
-
RedisProperties
Constructs a newRedisPropertiesinstance. -
RedisProperties
Constructs a newRedisPropertiesinstance.- Parameters:
key- Redis key of this property map.operations-RedisOperationsfor this properties.- See Also:
-
RedisProperties
public RedisProperties(@Nullable Properties defaults, BoundHashOperations<String, String, String> boundOps) Constructs a newRedisPropertiesinstance.- Parameters:
defaults- default properties to apply, can be null.boundOps-BoundHashOperationsfor this properties.
-
RedisProperties
Constructs a newRedisPropertiesinstance.- Parameters:
defaults- default properties to apply, can be null.key- Redis key of this property map.operations-RedisOperationsfor this properties.- See Also:
-
-
Method Details
-
get
-
put
-
putAll
-
propertyNames
- Overrides:
propertyNamesin classProperties
-
clear
public void clear() -
clone
- Overrides:
clonein classProperties
-
contains
- Overrides:
containsin classProperties
-
containsKey
- Specified by:
containsKeyin interfaceMap<Object,Object> - Overrides:
containsKeyin classProperties
-
containsValue
- Specified by:
containsValuein interfaceMap<Object,Object> - Overrides:
containsValuein classProperties
-
elements
- Overrides:
elementsin classProperties
-
entrySet
-
equals
-
hashCode
public int hashCode() -
isEmpty
public boolean isEmpty() -
keys
- Overrides:
keysin classProperties
-
keySet
-
remove
-
size
public int size() -
values
-
increment
Description copied from interface:RedisMapIncrementvalueof the hashkeyby the givendelta. -
increment
Description copied from interface:RedisMapIncrementvalueof the hashkeyby the givendelta. -
randomKey
Description copied from interface:RedisMapGet a random key from the hash. -
randomEntry
Description copied from interface:RedisMapGet a random entry from the hash.- Specified by:
randomEntryin interfaceRedisMap<Object,Object> - Returns:
- null if the hash does not exist.
-
getOperations
Description copied from interface:RedisStoreReturns the underlying Redis operations used by the backing implementation.- Specified by:
getOperationsin interfaceBoundKeyOperations<String>- Specified by:
getOperationsin interfaceRedisStore- Returns:
- operations never null.
-
expire
Description copied from interface:BoundKeyOperationsSets the key time-to-live/expiration.- Specified by:
expirein interfaceBoundKeyOperations<String>- Parameters:
timeout- expiration valueunit- expiration unit- Returns:
- true if expiration was set, false otherwise. null when used in pipeline / transaction.
-
expireAt
Description copied from interface:BoundKeyOperationsSets the key time-to-live/expiration.- Specified by:
expireAtin interfaceBoundKeyOperations<String>- Parameters:
date- expiration date- Returns:
- true if expiration was set, false otherwise. null when used in pipeline / transaction.
-
getExpire
Description copied from interface:BoundKeyOperationsReturns the expiration of this key.- Specified by:
getExpirein interfaceBoundKeyOperations<String>- Returns:
- expiration value (in seconds). null when used in pipeline / transaction.
-
getKey
Description copied from interface:BoundKeyOperationsReturns the key associated with this entity.- Specified by:
getKeyin interfaceBoundKeyOperations<String>- Returns:
- key associated with the implementing entity
-
getType
Description copied from interface:BoundKeyOperationsReturns the associated Redis type.- Specified by:
getTypein interfaceBoundKeyOperations<String>- Returns:
- key type. null when used in pipeline / transaction.
-
persist
Description copied from interface:BoundKeyOperationsRemoves the expiration (if any) of the key.- Specified by:
persistin interfaceBoundKeyOperations<String>- Returns:
- true if expiration was removed, false otherwise. null when used in pipeline / transaction.
-
rename
Description copied from interface:BoundKeyOperationsRenames the key.
Note: The new name for empty collections will be propagated on add of first element.- Specified by:
renamein interfaceBoundKeyOperations<String>- Parameters:
newKey- new key. Must not be null.
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<Object,Object> - Specified by:
putIfAbsentin interfaceMap<Object,Object> - Overrides:
putIfAbsentin classProperties
-
remove
- Specified by:
removein interfaceConcurrentMap<Object,Object> - Specified by:
removein interfaceMap<Object,Object> - Overrides:
removein classProperties
-
replace
- Specified by:
replacein interfaceConcurrentMap<Object,Object> - Specified by:
replacein interfaceMap<Object,Object> - Overrides:
replacein classProperties
-
replace
- Specified by:
replacein interfaceConcurrentMap<Object,Object> - Specified by:
replacein interfaceMap<Object,Object> - Overrides:
replacein classProperties
-
storeToXML
- Overrides:
storeToXMLin classProperties- Throws:
IOException
-
storeToXML
- Overrides:
storeToXMLin classProperties- Throws:
IOException
-
scan
-
hashFieldExpiration
Description copied from interface:RedisMapReturns a bound operations object to perform operations on the hash field expiration for all hash fields at the boundBoundKeyOperations.getKey(). Operations on the expiration object obtain keys at the time of invoking any expiration operation.- Specified by:
hashFieldExpirationin interfaceRedisMap<Object,Object> - Returns:
- the bound operations object to perform operations on the hash field expiration.
-
hashFieldExpiration
public BoundHashFieldExpirationOperations<Object> hashFieldExpiration(Collection<Object> hashFields) Description copied from interface:RedisMapReturns a bound operations object to perform operations on the hash field expiration for all hash fields at the boundBoundKeyOperations.getKey()for the given hash fields.- Specified by:
hashFieldExpirationin interfaceRedisMap<Object,Object> - Parameters:
hashFields- collection of hash fields to operate on.- Returns:
- the bound operations object to perform operations on the hash field expiration.
-