Tag: Value module CTI character Boolean operation call work end
Spring Data Redis
The operation of the string, encapsulated in the ValueOperations
and BoundValueOperations
, after the integration of the SPD, where needed to introduce:
// 注入模板操作实例@Autowiredprivate RedisTemplate template;// 从模板中取出对应的操作类实例@Resource(name = "redisTemplate")private ValueOperations valueOps;
Because the Redis
keys and values stored in are usually java.lang.String
, the modules are Redis
RedisConnection
and RedisTemplate
provide two extensions, respectively StringRedisConnection
(and their DefaultStringRedisConnection
implementations) and StringRedisTemplate
(equivalent RedisTemplate<String, String>
).
org.springframework.data.redis.core.StringRedisTemplate
The source code is as follows:
public class Stringredistemplate extends Redistemplate<string, string> {/** * Constructs a new <code>stringre distemplate</code> instance. {@link #setConnectionFactory (redisconnectionfactory)} * and {@link #afterPropertiesSet ()} still need to be called. */public stringredistemplate () {redisserializer<string> Stringserializer = new Stringredisserializer (); Setkeyserializer (Stringserializer); Setvalueserializer (Stringserializer); Sethashkeyserializer (Stringserializer); Sethashvalueserializer (Stringserializer);} /** * Constructs a new <code>StringRedisTemplate</code> instance ready to be used. * * @param connectionfactory Connection factory for creating new connections */public Stringredistemplate (redisconnection Factory connectionfactory) {this (); Setconnectionfactory (ConnectionFactory); Afterpropertiesset ();} Protected redisconnection preprocessconnection (redisconnection connection, Boolean existingconnection) {return new DeFaultstringredisconnection (connection);}}
is actually inherited from Redistemplate
Spring Data Redis Getting Started sample: string manipulation (vi)