Class StringRedisTemplate
java.lang.Object
org.springframework.data.redis.core.RedisAccessor
org.springframework.data.redis.core.RedisTemplate<String,String>
org.springframework.data.redis.core.StringRedisTemplate
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,InitializingBean
,RedisOperations<String,
String>
String-focused extension of RedisTemplate. Since most operations against Redis are String based, this class provides
a dedicated class that minimizes configuration of its more generic
template
especially in terms
of serializers.
Note that this template exposes the RedisConnection
used by the RedisCallback
as a
StringRedisConnection
.
- Author:
- Costin Leau, Mark Paluch
-
Field Summary
Fields inherited from class org.springframework.data.redis.core.RedisAccessor
logger
-
Constructor Summary
ConstructorDescriptionConstructs a newStringRedisTemplate
instance.StringRedisTemplate
(RedisConnectionFactory connectionFactory) Constructs a newStringRedisTemplate
instance ready to be used. -
Method Summary
Modifier and TypeMethodDescriptionprotected RedisConnection
preProcessConnection
(RedisConnection connection, boolean existingConnection) Processes the connection (before any settings are executed on it).Methods inherited from class org.springframework.data.redis.core.RedisTemplate
afterPropertiesSet, boundGeoOps, boundHashOps, boundListOps, boundSetOps, boundStreamOps, boundValueOps, boundZSetOps, convertAndSend, copy, countExistingKeys, createRedisConnectionProxy, delete, delete, discard, dump, exec, exec, execRaw, execute, execute, execute, execute, execute, execute, executePipelined, executePipelined, executePipelined, executePipelined, executeWithStickyConnection, expire, expireAt, getClientList, getDefaultSerializer, getExpire, getExpire, getHashKeySerializer, getHashValueSerializer, getKeySerializer, getStringSerializer, getValueSerializer, hasKey, isEnableDefaultSerializer, isExposeConnection, keys, killClient, move, multi, opsForCluster, opsForGeo, opsForHash, opsForHyperLogLog, opsForList, opsForSet, opsForStream, opsForStream, opsForValue, opsForZSet, persist, postProcessResult, randomKey, rename, renameIfAbsent, replicaOf, replicaOfNoOne, restore, scan, setBeanClassLoader, setDefaultSerializer, setEnableDefaultSerializer, setEnableTransactionSupport, setExposeConnection, setHashKeySerializer, setHashValueSerializer, setKeySerializer, setScriptExecutor, setStringSerializer, setValueSerializer, sort, sort, sort, sort, sort, type, unlink, unlink, unwatch, watch, watch
Methods inherited from class org.springframework.data.redis.core.RedisAccessor
getConnectionFactory, getRequiredConnectionFactory, setConnectionFactory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.redis.core.RedisOperations
expire, expireAt, restore
-
Constructor Details
-
StringRedisTemplate
public StringRedisTemplate()Constructs a newStringRedisTemplate
instance.RedisAccessor.setConnectionFactory(RedisConnectionFactory)
andRedisTemplate.afterPropertiesSet()
still need to be called. -
StringRedisTemplate
Constructs a newStringRedisTemplate
instance ready to be used.- Parameters:
connectionFactory
- connection factory for creating new connections
-
-
Method Details
-
preProcessConnection
protected RedisConnection preProcessConnection(RedisConnection connection, boolean existingConnection) Description copied from class:RedisTemplate
Processes the connection (before any settings are executed on it). Default implementation returns the connection as is.- Overrides:
preProcessConnection
in classRedisTemplate<String,
String> - Parameters:
connection
- redis connection
-