K - the Redis key type against which the template works (usually a String)V - the Redis value type against which the template workspublic class RedisTemplate<K,V> extends RedisAccessor implements RedisOperations<K,V>, BeanClassLoaderAware
Performs automatic serialization/deserialization between the given objects and the underlying binary data in the
Redis store. By default, it uses Java serialization for its objects (through JdkSerializationRedisSerializer
). For String intensive operations consider the dedicated StringRedisTemplate.
The central method is execute, supporting Redis access code implementing the RedisCallback interface. It
provides RedisConnection handling such that neither the RedisCallback implementation nor the calling
code needs to explicitly care about retrieving/closing Redis connections, or handling Connection lifecycle
exceptions. For typical single step actions, there are various convenience methods.
Once configured, this class is thread-safe.
Note that while the template is generified, it is up to the serializers/deserializers to properly convert the given Objects to and from binary data.
This is the central class in Redis support.
StringRedisTemplatelogger| Constructor and Description |
|---|
RedisTemplate()
Constructs a new
RedisTemplate instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
BoundGeoOperations<K,V> |
boundGeoOps(K key)
Returns geospatial specific operations interface bound to the given key.
|
<HK,HV> BoundHashOperations<K,HK,HV> |
boundHashOps(K key)
Returns the operations performed on hash values bound to the given key.
|
BoundListOperations<K,V> |
boundListOps(K key)
Returns the operations performed on list values bound to the given key.
|
BoundSetOperations<K,V> |
boundSetOps(K key)
Returns the operations performed on set values bound to the given key.
|
<HK,HV> BoundStreamOperations<K,HK,HV> |
boundStreamOps(K key)
Returns the operations performed on Streams bound to the given key.
|
BoundValueOperations<K,V> |
boundValueOps(K key)
Returns the operations performed on simple values (or Strings in Redis terminology) bound to the given key.
|
BoundZSetOperations<K,V> |
boundZSetOps(K key)
Returns the operations performed on zset values (also known as sorted sets) bound to the given key.
|
void |
convertAndSend(String channel,
Object message)
Publishes the given message to the given channel.
|
Boolean |
copy(K source,
K target,
boolean replace)
Copy given
sourceKey to targetKey. |
Long |
countExistingKeys(Collection<K> keys)
Count the number of
keys that exist. |
protected RedisConnection |
createRedisConnectionProxy(RedisConnection connection) |
Long |
delete(Collection<K> keys)
Delete given
keys. |
Boolean |
delete(K key)
Delete given
key. |
void |
discard()
Discard all commands issued after
RedisOperations.multi(). |
byte[] |
dump(K key)
Executes the Redis dump command and returns the results.
|
List<Object> |
exec()
Execute a transaction, using the default
RedisSerializers to deserialize any results that are byte[]s or
Collections or Maps of byte[]s or Tuples. |
List<Object> |
exec(RedisSerializer<?> valueSerializer)
Execute a transaction, using the provided
RedisSerializer to deserialize any results that are byte[]s or
Collections of byte[]s. |
protected List<Object> |
execRaw() |
<T> T |
execute(RedisCallback<T> action)
Executes the given action within a Redis connection.
|
<T> T |
execute(RedisCallback<T> action,
boolean exposeConnection)
Executes the given action object within a connection, which can be exposed or not.
|
<T> T |
execute(RedisCallback<T> action,
boolean exposeConnection,
boolean pipeline)
Executes the given action object within a connection that can be exposed or not.
|
<T> T |
execute(RedisScript<T> script,
List<K> keys,
Object... args)
Executes the given
RedisScript |
<T> T |
execute(RedisScript<T> script,
RedisSerializer<?> argsSerializer,
RedisSerializer<T> resultSerializer,
List<K> keys,
Object... args)
Executes the given
RedisScript, using the provided RedisSerializers to serialize the script
arguments and result. |
<T> T |
execute(SessionCallback<T> session)
Executes a Redis session.
|
List<Object> |
executePipelined(RedisCallback<?> action)
Executes the given action object on a pipelined connection, returning the results.
|
List<Object> |
executePipelined(RedisCallback<?> action,
RedisSerializer<?> resultSerializer)
Executes the given action object on a pipelined connection, returning the results using a dedicated serializer.
|
List<Object> |
executePipelined(SessionCallback<?> session)
Executes the given Redis session on a pipelined connection.
|
List<Object> |
executePipelined(SessionCallback<?> session,
RedisSerializer<?> resultSerializer)
Executes the given Redis session on a pipelined connection, returning the results using a dedicated serializer.
|
<T extends Closeable> |
executeWithStickyConnection(RedisCallback<T> callback)
Allocates and binds a new
RedisConnection to the actual return type of the method. |
Boolean |
expire(K key,
long timeout,
TimeUnit unit)
Set time to live for given
key. |
Boolean |
expireAt(K key,
Date date)
Set the expiration for given
key as a date timestamp. |
List<RedisClientInfo> |
getClientList()
Request information and statistics about connected clients.
|
RedisSerializer<?> |
getDefaultSerializer()
Returns the default serializer used by this template.
|
Long |
getExpire(K key)
Get the time to live for
key in seconds. |
Long |
getExpire(K key,
TimeUnit timeUnit)
Get the time to live for
key in and convert it to the given TimeUnit. |
RedisSerializer<?> |
getHashKeySerializer()
Returns the hashKeySerializer.
|
RedisSerializer<?> |
getHashValueSerializer()
Returns the hashValueSerializer.
|
RedisSerializer<?> |
getKeySerializer()
Returns the key serializer used by this template.
|
RedisSerializer<String> |
getStringSerializer()
Returns the stringSerializer.
|
RedisSerializer<?> |
getValueSerializer()
Returns the value serializer used by this template.
|
Boolean |
hasKey(K key)
Determine if given
key exists. |
boolean |
isEnableDefaultSerializer() |
boolean |
isExposeConnection()
Returns whether to expose the native Redis connection to RedisCallback code, or rather a connection proxy (the
default).
|
Set<K> |
keys(K pattern)
Find all keys matching the given
pattern. |
void |
killClient(String host,
int port)
Closes a given client connection identified by ip:port given in
client. |
Boolean |
move(K key,
int dbIndex)
Move given
key to database with index. |
void |
multi()
Mark the start of a transaction block.
|
ClusterOperations<K,V> |
opsForCluster()
Returns the cluster specific operations interface.
|
GeoOperations<K,V> |
opsForGeo()
Returns geospatial specific operations interface.
|
<HK,HV> HashOperations<K,HK,HV> |
opsForHash()
Returns the operations performed on hash values.
|
HyperLogLogOperations<K,V> |
opsForHyperLogLog() |
ListOperations<K,V> |
opsForList()
Returns the operations performed on list values.
|
SetOperations<K,V> |
opsForSet()
Returns the operations performed on set values.
|
<HK,HV> StreamOperations<K,HK,HV> |
opsForStream()
Returns the operations performed on Streams.
|
<HK,HV> StreamOperations<K,HK,HV> |
opsForStream(HashMapper<? super K,? super HK,? super HV> hashMapper)
Returns the operations performed on Streams.
|
ValueOperations<K,V> |
opsForValue()
Returns the operations performed on simple values (or Strings in Redis terminology).
|
ZSetOperations<K,V> |
opsForZSet()
Returns the operations performed on zset values (also known as sorted sets).
|
Boolean |
persist(K key)
Remove the expiration from given
key. |
protected <T> T |
postProcessResult(T result,
RedisConnection conn,
boolean existingConnection) |
protected RedisConnection |
preProcessConnection(RedisConnection connection,
boolean existingConnection)
Processes the connection (before any settings are executed on it).
|
K |
randomKey()
Return a random key from the keyspace.
|
void |
rename(K oldKey,
K newKey)
Rename key
oldKey to newKey. |
Boolean |
renameIfAbsent(K oldKey,
K newKey)
Rename key
oldKey to newKey only if newKey does not exist. |
void |
restore(K key,
byte[] value,
long timeToLive,
TimeUnit unit,
boolean replace)
Executes the Redis restore command.
|
Cursor<K> |
scan(ScanOptions options)
Use a
Cursor to iterate over keys. |
void |
setBeanClassLoader(ClassLoader classLoader)
Set the
ClassLoader to be used for the default JdkSerializationRedisSerializer in case no other
RedisSerializer is explicitly set as the default one. |
void |
setDefaultSerializer(RedisSerializer<?> serializer)
Sets the default serializer to use for this template.
|
void |
setEnableDefaultSerializer(boolean enableDefaultSerializer) |
void |
setEnableTransactionSupport(boolean enableTransactionSupport)
If set to
true RedisTemplate will participate in ongoing transactions using
MULTI...EXEC|DISCARD to keep track of operations. |
void |
setExposeConnection(boolean exposeConnection)
Sets whether to expose the Redis connection to
RedisCallback code. |
void |
setHashKeySerializer(RedisSerializer<?> hashKeySerializer)
Sets the hash key (or field) serializer to be used by this template.
|
void |
setHashValueSerializer(RedisSerializer<?> hashValueSerializer)
Sets the hash value serializer to be used by this template.
|
void |
setKeySerializer(RedisSerializer<?> serializer)
Sets the key serializer to be used by this template.
|
void |
setScriptExecutor(ScriptExecutor<K> scriptExecutor) |
void |
setStringSerializer(RedisSerializer<String> stringSerializer)
Sets the string value serializer to be used by this template (when the arguments or return types are always
strings).
|
void |
setValueSerializer(RedisSerializer<?> serializer)
Sets the value serializer to be used by this template.
|
void |
slaveOf(String host,
int port)
Change redis replication setting to new master.
|
void |
slaveOfNoOne()
Change server into master.
|
List<V> |
sort(SortQuery<K> query)
Sort the elements for
query. |
<T,S> List<T> |
sort(SortQuery<K> query,
BulkMapper<T,S> bulkMapper,
RedisSerializer<S> resultSerializer)
|
<T> List<T> |
sort(SortQuery<K> query,
BulkMapper<T,V> bulkMapper)
Sort the elements for
query applying BulkMapper. |
Long |
sort(SortQuery<K> query,
K storeKey)
Sort the elements for
query and store result in storeKey. |
<T> List<T> |
sort(SortQuery<K> query,
RedisSerializer<T> resultSerializer)
Sort the elements for
query applying RedisSerializer. |
DataType |
type(K key)
Determine the type stored at
key. |
Long |
unlink(Collection<K> keys)
Unlink the
keys from the keyspace. |
Boolean |
unlink(K key)
Unlink the
key from the keyspace. |
void |
unwatch()
Flushes all the previously
RedisOperations.watch(Object) keys. |
void |
watch(Collection<K> keys)
Watch given
keys for modifications during transaction started with RedisOperations.multi(). |
void |
watch(K key)
Watch given
key for modifications during transaction started with RedisOperations.multi(). |
getConnectionFactory, getRequiredConnectionFactory, setConnectionFactoryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexpire, expireAt, restorepublic void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanafterPropertiesSet in class RedisAccessor@Nullable public <T> T execute(RedisCallback<T> action)
RedisOperationsexecute in interface RedisOperations<K,V>T - return typeaction - callback object that specifies the Redis action. Must not be null.@Nullable public <T> T execute(RedisCallback<T> action, boolean exposeConnection)
T - return typeaction - callback object that specifies the Redis actionexposeConnection - whether to enforce exposure of the native Redis Connection to callback code@Nullable public <T> T execute(RedisCallback<T> action, boolean exposeConnection, boolean pipeline)
T - return typeaction - callback object to executeexposeConnection - whether to enforce exposure of the native Redis Connection to callback codepipeline - whether to pipeline or not the connection for the executionpublic <T> T execute(SessionCallback<T> session)
RedisOperationsRedisOperations.multi() and RedisOperations.watch(Collection) operations.execute in interface RedisOperations<K,V>T - return typesession - session callback. Must not be null.public List<Object> executePipelined(SessionCallback<?> session)
RedisOperationsexecutePipelined in interface RedisOperations<K,V>session - Session callbackpublic List<Object> executePipelined(SessionCallback<?> session, @Nullable RedisSerializer<?> resultSerializer)
RedisOperationsexecutePipelined in interface RedisOperations<K,V>session - Session callbackpublic List<Object> executePipelined(RedisCallback<?> action)
RedisOperationsexecutePipelined in interface RedisOperations<K,V>action - callback object to executepublic List<Object> executePipelined(RedisCallback<?> action, @Nullable RedisSerializer<?> resultSerializer)
RedisOperationsexecutePipelined in interface RedisOperations<K,V>action - callback object to executeresultSerializer - The Serializer to use for individual values or Collections of values. If any returned
values are hashes, this serializer will be used to deserialize both the key and valuepublic <T> T execute(RedisScript<T> script, List<K> keys, Object... args)
RedisOperationsRedisScriptexecute in interface RedisOperations<K,V>script - The script to executekeys - Any keys that need to be passed to the scriptargs - Any args that need to be passed to the scriptRedisScript.getResultType() is null, likely indicating a
throw-away status reply (i.e. "OK")public <T> T execute(RedisScript<T> script, RedisSerializer<?> argsSerializer, RedisSerializer<T> resultSerializer, List<K> keys, Object... args)
RedisOperationsRedisScript, using the provided RedisSerializers to serialize the script
arguments and result.execute in interface RedisOperations<K,V>script - The script to executeargsSerializer - The RedisSerializer to use for serializing argsresultSerializer - The RedisSerializer to use for serializing the script return valuekeys - Any keys that need to be passed to the scriptargs - Any args that need to be passed to the scriptRedisScript.getResultType() is null, likely indicating a
throw-away status reply (i.e. "OK")public <T extends Closeable> T executeWithStickyConnection(RedisCallback<T> callback)
RedisOperationsRedisConnection to the actual return type of the method. It is up to the caller
to free resources after use.executeWithStickyConnection in interface RedisOperations<K,V>callback - must not be null.protected RedisConnection createRedisConnectionProxy(RedisConnection connection)
protected RedisConnection preProcessConnection(RedisConnection connection, boolean existingConnection)
connection - redis connection@Nullable protected <T> T postProcessResult(@Nullable T result, RedisConnection conn, boolean existingConnection)
public boolean isExposeConnection()
public void setExposeConnection(boolean exposeConnection)
RedisCallback code. Default is "false": a proxy will be
returned, suppressing quit and disconnect calls.exposeConnection - public boolean isEnableDefaultSerializer()
public void setEnableDefaultSerializer(boolean enableDefaultSerializer)
enableDefaultSerializer - Whether or not the default serializer should be used. If not, any serializers not
explicitly set will remain null and values will not be serialized or deserialized.@Nullable public RedisSerializer<?> getDefaultSerializer()
public void setDefaultSerializer(RedisSerializer<?> serializer)
setStringSerializer(RedisSerializer)) are initialized to this value unless explicitly set. Defaults to
JdkSerializationRedisSerializer.serializer - default serializer to usepublic void setKeySerializer(RedisSerializer<?> serializer)
getDefaultSerializer().serializer - the key serializer to be used by this template.public RedisSerializer<?> getKeySerializer()
getKeySerializer in interface RedisOperations<K,V>public void setValueSerializer(RedisSerializer<?> serializer)
getDefaultSerializer().serializer - the value serializer to be used by this template.public RedisSerializer<?> getValueSerializer()
getValueSerializer in interface RedisOperations<K,V>public RedisSerializer<?> getHashKeySerializer()
getHashKeySerializer in interface RedisOperations<K,V>public void setHashKeySerializer(RedisSerializer<?> hashKeySerializer)
getDefaultSerializer().hashKeySerializer - The hashKeySerializer to set.public RedisSerializer<?> getHashValueSerializer()
getHashValueSerializer in interface RedisOperations<K,V>public void setHashValueSerializer(RedisSerializer<?> hashValueSerializer)
getDefaultSerializer().hashValueSerializer - The hashValueSerializer to set.public RedisSerializer<String> getStringSerializer()
public void setStringSerializer(RedisSerializer<String> stringSerializer)
StringRedisSerializer.stringSerializer - The stringValueSerializer to set.ValueOperations.get(Object, long, long)public void setScriptExecutor(ScriptExecutor<K> scriptExecutor)
scriptExecutor - The ScriptExecutor to use for executing Redis scriptspublic List<Object> exec()
RedisSerializers to deserialize any results that are byte[]s or
Collections or Maps of byte[]s or Tuples. Other result types (Long, Boolean, etc) are left as-is in the converted
results. If conversion of tx results has been disabled in the RedisConnectionFactory, the results of exec
will be returned without deserialization. This check is mostly for backwards compatibility with 1.0.exec in interface RedisOperations<K,V>public List<Object> exec(RedisSerializer<?> valueSerializer)
RedisOperationsRedisSerializer to deserialize any results that are byte[]s or
Collections of byte[]s. If a result is a Map, the provided RedisSerializer will be used for both the keys
and values. Other result types (Long, Boolean, etc) are left as-is in the converted results. Tuple results are
automatically converted to TypedTuples.exec in interface RedisOperations<K,V>valueSerializer - The RedisSerializer to use for deserializing the results of transaction execpublic Boolean copy(K source, K target, boolean replace)
RedisOperationssourceKey to targetKey.copy in interface RedisOperations<K,V>source - must not be null.target - must not be null.replace - whether the key was copied. null when used in pipeline / transaction.public Boolean delete(K key)
RedisOperationskey.delete in interface RedisOperations<K,V>key - must not be null.public Long delete(Collection<K> keys)
RedisOperationskeys.delete in interface RedisOperations<K,V>keys - must not be null.public Boolean unlink(K key)
RedisOperationskey from the keyspace. Unlike with RedisOperations.delete(Object) the actual memory reclaiming here
happens asynchronously.unlink in interface RedisOperations<K,V>key - must not be null.public Long unlink(Collection<K> keys)
RedisOperationskeys from the keyspace. Unlike with RedisOperations.delete(Collection) the actual memory reclaiming
here happens asynchronously.unlink in interface RedisOperations<K,V>keys - must not be null.public Boolean hasKey(K key)
RedisOperationskey exists.hasKey in interface RedisOperations<K,V>key - must not be null.public Long countExistingKeys(Collection<K> keys)
RedisOperationskeys that exist.countExistingKeys in interface RedisOperations<K,V>keys - must not be null.public Boolean expire(K key, long timeout, TimeUnit unit)
RedisOperationskey.expire in interface RedisOperations<K,V>key - must not be null.unit - must not be null.public Boolean expireAt(K key, Date date)
RedisOperationskey as a date timestamp.expireAt in interface RedisOperations<K,V>key - must not be null.date - must not be null.public void convertAndSend(String channel, Object message)
RedisOperationsconvertAndSend in interface RedisOperations<K,V>channel - the channel to publish to, must not be null.message - message to publishpublic Long getExpire(K key)
RedisOperationskey in seconds.getExpire in interface RedisOperations<K,V>key - must not be null.public Long getExpire(K key, TimeUnit timeUnit)
RedisOperationskey in and convert it to the given TimeUnit.getExpire in interface RedisOperations<K,V>key - must not be null.timeUnit - must not be null.public Set<K> keys(K pattern)
RedisOperationspattern.keys in interface RedisOperations<K,V>pattern - must not be null.public Cursor<K> scan(ScanOptions options)
RedisOperationsCursor to iterate over keys. CloseableIterator.close() when done to avoid resource leaks.scan in interface RedisOperations<K,V>options - must not be null.public Boolean persist(K key)
RedisOperationskey.persist in interface RedisOperations<K,V>key - must not be null.public Boolean move(K key, int dbIndex)
RedisOperationskey to database with index.move in interface RedisOperations<K,V>key - must not be null.public K randomKey()
RedisOperationsrandomKey in interface RedisOperations<K,V>public void rename(K oldKey, K newKey)
RedisOperationsoldKey to newKey.rename in interface RedisOperations<K,V>oldKey - must not be null.newKey - must not be null.public Boolean renameIfAbsent(K oldKey, K newKey)
RedisOperationsoldKey to newKey only if newKey does not exist.renameIfAbsent in interface RedisOperations<K,V>oldKey - must not be null.newKey - must not be null.public DataType type(K key)
RedisOperationskey.type in interface RedisOperations<K,V>key - must not be null.public byte[] dump(K key)
dump in interface RedisOperations<K,V>key - The key to dumppublic void restore(K key, byte[] value, long timeToLive, TimeUnit unit, boolean replace)
dump(Object), since Redis uses a non-standard serialization mechanism.restore in interface RedisOperations<K,V>key - The key to restorevalue - The value to restore, as returned by dump(Object)timeToLive - An expiration for the restored key, or 0 for no expirationunit - The time unit for timeToLivereplace - use true to replace a potentially existing value instead of erroring.RedisSystemException - if the key you are attempting to restore already exists and replace is set to
false.public void multi()
RedisOperationsRedisOperations.exec() or rolled back using RedisOperations.discard()multi in interface RedisOperations<K,V>public void discard()
RedisOperationsRedisOperations.multi().discard in interface RedisOperations<K,V>public void watch(K key)
RedisOperationskey for modifications during transaction started with RedisOperations.multi().watch in interface RedisOperations<K,V>key - must not be null.public void watch(Collection<K> keys)
RedisOperationskeys for modifications during transaction started with RedisOperations.multi().watch in interface RedisOperations<K,V>keys - must not be null.public void unwatch()
RedisOperationsRedisOperations.watch(Object) keys.unwatch in interface RedisOperations<K,V>public List<V> sort(SortQuery<K> query)
RedisOperationsquery.sort in interface RedisOperations<K,V>query - must not be null.public <T> List<T> sort(SortQuery<K> query, @Nullable RedisSerializer<T> resultSerializer)
RedisOperationsquery applying RedisSerializer.sort in interface RedisOperations<K,V>query - must not be null.public <T> List<T> sort(SortQuery<K> query, BulkMapper<T,V> bulkMapper)
RedisOperationsquery applying BulkMapper.sort in interface RedisOperations<K,V>query - must not be null.public <T,S> List<T> sort(SortQuery<K> query, BulkMapper<T,S> bulkMapper, @Nullable RedisSerializer<S> resultSerializer)
RedisOperationssort in interface RedisOperations<K,V>query - must not be null.public Long sort(SortQuery<K> query, K storeKey)
RedisOperationsquery and store result in storeKey.sort in interface RedisOperations<K,V>query - must not be null.storeKey - must not be null.public void killClient(String host, int port)
RedisOperationsclient.killClient in interface RedisOperations<K,V>host - of connection to close.port - of connection to closepublic List<RedisClientInfo> getClientList()
RedisOperationsgetClientList in interface RedisOperations<K,V>List of RedisClientInfo objects.public void slaveOf(String host, int port)
RedisOperationsslaveOf in interface RedisOperations<K,V>host - must not be null.public void slaveOfNoOne()
RedisOperationsslaveOfNoOne in interface RedisOperations<K,V>public ClusterOperations<K,V> opsForCluster()
RedisOperationsopsForCluster in interface RedisOperations<K,V>public GeoOperations<K,V> opsForGeo()
RedisOperationsopsForGeo in interface RedisOperations<K,V>public BoundGeoOperations<K,V> boundGeoOps(K key)
RedisOperationsboundGeoOps in interface RedisOperations<K,V>key - must not be null.public <HK,HV> BoundHashOperations<K,HK,HV> boundHashOps(K key)
RedisOperationsboundHashOps in interface RedisOperations<K,V>HK - hash key (or field) typeHV - hash value typekey - Redis keypublic <HK,HV> HashOperations<K,HK,HV> opsForHash()
RedisOperationsopsForHash in interface RedisOperations<K,V>HK - hash key (or field) typeHV - hash value typepublic HyperLogLogOperations<K,V> opsForHyperLogLog()
opsForHyperLogLog in interface RedisOperations<K,V>public ListOperations<K,V> opsForList()
RedisOperationsopsForList in interface RedisOperations<K,V>public BoundListOperations<K,V> boundListOps(K key)
RedisOperationsboundListOps in interface RedisOperations<K,V>key - Redis keypublic BoundSetOperations<K,V> boundSetOps(K key)
RedisOperationsboundSetOps in interface RedisOperations<K,V>key - Redis keypublic SetOperations<K,V> opsForSet()
RedisOperationsopsForSet in interface RedisOperations<K,V>public <HK,HV> StreamOperations<K,HK,HV> opsForStream()
RedisOperationsopsForStream in interface RedisOperations<K,V>public <HK,HV> StreamOperations<K,HK,HV> opsForStream(HashMapper<? super K,? super HK,? super HV> hashMapper)
RedisOperationsopsForStream in interface RedisOperations<K,V>hashMapper - the HashMapper to use when converting ObjectRecord.public <HK,HV> BoundStreamOperations<K,HK,HV> boundStreamOps(K key)
RedisOperationsboundStreamOps in interface RedisOperations<K,V>public BoundValueOperations<K,V> boundValueOps(K key)
RedisOperationsboundValueOps in interface RedisOperations<K,V>key - Redis keypublic ValueOperations<K,V> opsForValue()
RedisOperationsopsForValue in interface RedisOperations<K,V>public BoundZSetOperations<K,V> boundZSetOps(K key)
RedisOperationsboundZSetOps in interface RedisOperations<K,V>key - Redis keypublic ZSetOperations<K,V> opsForZSet()
RedisOperationsopsForZSet in interface RedisOperations<K,V>public void setEnableTransactionSupport(boolean enableTransactionSupport)
true RedisTemplate will participate in ongoing transactions using
MULTI...EXEC|DISCARD to keep track of operations.enableTransactionSupport - whether to participate in ongoing transactions.RedisConnectionUtils.getConnection(RedisConnectionFactory, boolean),
TransactionSynchronizationManager.isActualTransactionActive()public void setBeanClassLoader(ClassLoader classLoader)
ClassLoader to be used for the default JdkSerializationRedisSerializer in case no other
RedisSerializer is explicitly set as the default one.setBeanClassLoader in interface BeanClassLoaderAwareclassLoader - can be null.BeanClassLoaderAware.setBeanClassLoader(java.lang.ClassLoader)Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.