Spring Data Redis Getting Started sample: string manipulation (vi)

Source: Internet
Author: User

Tag: Value module CTI character Boolean operation call work end

Spring Data RedisThe 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.StringRedisTemplateThe 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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.