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
ConstructorDescriptionRedisProperties
(String key, RedisOperations<String, ?> operations) Constructs a newRedisProperties
instance.RedisProperties
(Properties defaults, String key, RedisOperations<String, ?> operations) Constructs a newRedisProperties
instance.RedisProperties
(Properties defaults, BoundHashOperations<String, String, String> boundOps) Constructs a newRedisProperties
instance.RedisProperties
(BoundHashOperations<String, String, String> boundOps) Constructs a newRedisProperties
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
clone()
boolean
boolean
containsKey
(Object key) boolean
containsValue
(Object value) elements()
entrySet()
boolean
Sets 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.int
hashCode()
Incrementvalue
of the hashkey
by the givendelta
.Incrementvalue
of the hashkey
by the givendelta
.boolean
isEmpty()
keys()
keySet()
persist()
Removes the expiration (if any) of the key.Enumeration<?>
void
putIfAbsent
(Object key, Object value) Get a random entry from the hash.Get a random key from the hash.boolean
void
Renames the key.boolean
scan()
int
size()
void
storeToXML
(OutputStream os, String comment) void
storeToXML
(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, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.data.redis.core.BoundKeyOperations
expire, expireAt
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Constructor Details
-
RedisProperties
Constructs a newRedisProperties
instance. -
RedisProperties
Constructs a newRedisProperties
instance.- Parameters:
key
- Redis key of this property map.operations
-RedisOperations
for this properties.- See Also:
-
RedisProperties
public RedisProperties(@Nullable Properties defaults, BoundHashOperations<String, String, String> boundOps) Constructs a newRedisProperties
instance.- Parameters:
defaults
- default properties to apply, can be null.boundOps
-BoundHashOperations
for this properties.
-
RedisProperties
Constructs a newRedisProperties
instance.- Parameters:
defaults
- default properties to apply, can be null.key
- Redis key of this property map.operations
-RedisOperations
for this properties.- See Also:
-
-
Method Details
-
get
-
put
-
putAll
-
propertyNames
- Overrides:
propertyNames
in classProperties
-
clear
public void clear() -
clone
- Overrides:
clone
in classProperties
-
contains
- Overrides:
contains
in classProperties
-
containsKey
- Specified by:
containsKey
in interfaceMap<Object,
Object> - Overrides:
containsKey
in classProperties
-
containsValue
- Specified by:
containsValue
in interfaceMap<Object,
Object> - Overrides:
containsValue
in classProperties
-
elements
- Overrides:
elements
in classProperties
-
entrySet
-
equals
-
hashCode
public int hashCode() -
isEmpty
public boolean isEmpty() -
keys
- Overrides:
keys
in classProperties
-
keySet
-
remove
-
size
public int size() -
values
-
increment
Description copied from interface:RedisMap
Incrementvalue
of the hashkey
by the givendelta
. -
increment
Description copied from interface:RedisMap
Incrementvalue
of the hashkey
by the givendelta
. -
randomKey
Description copied from interface:RedisMap
Get a random key from the hash. -
randomEntry
Description copied from interface:RedisMap
Get a random entry from the hash.- Specified by:
randomEntry
in interfaceRedisMap<Object,
Object> - Returns:
- null if the hash does not exist.
-
getOperations
Description copied from interface:RedisStore
Returns the underlying Redis operations used by the backing implementation.- Specified by:
getOperations
in interfaceRedisStore
- Returns:
- operations never null.
-
expire
Description copied from interface:BoundKeyOperations
Sets the key time-to-live/expiration.- Specified by:
expire
in 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:BoundKeyOperations
Sets the key time-to-live/expiration.- Specified by:
expireAt
in 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:BoundKeyOperations
Returns the expiration of this key.- Specified by:
getExpire
in interfaceBoundKeyOperations<String>
- Returns:
- expiration value (in seconds). null when used in pipeline / transaction.
-
getKey
Description copied from interface:BoundKeyOperations
Returns the key associated with this entity.- Specified by:
getKey
in interfaceBoundKeyOperations<String>
- Returns:
- key associated with the implementing entity
-
getType
Description copied from interface:BoundKeyOperations
Returns the associated Redis type.- Specified by:
getType
in interfaceBoundKeyOperations<String>
- Returns:
- key type. null when used in pipeline / transaction.
-
persist
Description copied from interface:BoundKeyOperations
Removes the expiration (if any) of the key.- Specified by:
persist
in interfaceBoundKeyOperations<String>
- Returns:
- true if expiration was removed, false otherwise. null when used in pipeline / transaction.
-
rename
Description copied from interface:BoundKeyOperations
Renames the key.
Note: The new name for empty collections will be propagated on add of first element.- Specified by:
rename
in interfaceBoundKeyOperations<String>
- Parameters:
newKey
- new key. Must not be null.
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceConcurrentMap<Object,
Object> - Specified by:
putIfAbsent
in interfaceMap<Object,
Object> - Overrides:
putIfAbsent
in classProperties
-
remove
- Specified by:
remove
in interfaceConcurrentMap<Object,
Object> - Specified by:
remove
in interfaceMap<Object,
Object> - Overrides:
remove
in classProperties
-
replace
- Specified by:
replace
in interfaceConcurrentMap<Object,
Object> - Specified by:
replace
in interfaceMap<Object,
Object> - Overrides:
replace
in classProperties
-
replace
- Specified by:
replace
in interfaceConcurrentMap<Object,
Object> - Specified by:
replace
in interfaceMap<Object,
Object> - Overrides:
replace
in classProperties
-
storeToXML
- Overrides:
storeToXML
in classProperties
- Throws:
IOException
-
storeToXML
- Overrides:
storeToXML
in classProperties
- Throws:
IOException
-
scan
-