Class StringRedisTemplate

  extended by
      extended by<String,String>
          extended by
All Implemented Interfaces:
InitializingBean, RedisOperations<String,String>

public class StringRedisTemplate
extends RedisTemplate<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.

Field Summary
Fields inherited from class
Constructor Summary
          Constructs a new StringRedisTemplate instance.
StringRedisTemplate(RedisConnectionFactory connectionFactory)
          Constructs a new StringRedisTemplate instance ready to be used.
Method Summary
protected  RedisConnection preProcessConnection(RedisConnection connection, boolean existingConnection)
          Processes the connection (before any settings are executed on it).
Methods inherited from class
afterPropertiesSet, boundHashOps, boundListOps, boundSetOps, boundValueOps, boundZSetOps, convertAndSend, createRedisConnectionProxy, delete, delete, discard, exec, execute, execute, execute, execute, expire, expireAt, getDefaultSerializer, getExpire, getHashKeySerializer, getHashValueSerializer, getKeySerializer, getStringSerializer, getValueSerializer, hasKey, isExposeConnection, keys, move, multi, opsForHash, opsForList, opsForSet, opsForValue, opsForZSet, persist, postProcessResult, randomKey, rename, renameIfAbsent, setDefaultSerializer, setExposeConnection, setHashKeySerializer, setHashValueSerializer, setKeySerializer, setStringSerializer, setValueSerializer, sort, sort, sort, sort, sort, type, unwatch, watch, watch
Methods inherited from class
getConnectionFactory, setConnectionFactory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public StringRedisTemplate()
Constructs a new StringRedisTemplate instance. RedisAccessor.setConnectionFactory(RedisConnectionFactory) and RedisTemplate.afterPropertiesSet() still need to be called.


public StringRedisTemplate(RedisConnectionFactory connectionFactory)
Constructs a new StringRedisTemplate instance ready to be used.

connectionFactory - connection factory for creating new connections
Method Detail


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.

preProcessConnection in class RedisTemplate<String,String>
connection - redis connection