org.springframework.data.redis.core
Class StringRedisTemplate

java.lang.Object
  extended by org.springframework.data.redis.core.RedisAccessor
      extended by org.springframework.data.redis.core.RedisTemplate<String,String>
          extended by org.springframework.data.redis.core.StringRedisTemplate
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 org.springframework.data.redis.core.RedisAccessor
logger
 
Constructor Summary
StringRedisTemplate()
          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 org.springframework.data.redis.core.RedisTemplate
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 org.springframework.data.redis.core.RedisAccessor
getConnectionFactory, setConnectionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringRedisTemplate

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


StringRedisTemplate

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

Parameters:
connectionFactory - connection factory for creating new connections
Method Detail

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 class RedisTemplate<String,String>
Parameters:
connection - redis connection