The use of the redistemplate of Spring-data-redis

Source: Internet
Author: User
Tags hash redis serialization
Function Introduction


Most of the users like to use Redistemplate, and its corresponding package is org.springframework.data.redis.core. The template is actually the core class of the Redis module because of its rich functionality. Templates provide a high level of abstraction for redis interactions. Although Redisconnection provides a low-level way to accept and return binary values (byte arrays), the template can handle serialization and connection management so that users do not have to deal with too much detail.


In addition, templates provide operation views (grouped by Redis Command Reference), which provide a rich, out-of-the-box interface for operations on specific types or specific keys (via the Keybound interface), as described below:


Interface Description

Key type operation

Valueoperations

Manipulating Redis String (or value) type data

Listoperations

Manipulating Redis list type data

Setoperations

Manipulating Redis set type data

Zsetoperations

Manipulating Redis Zset (or sorted Set) type data

Hashoperations

Manipulating Redis Hash type data

Hyperloglogoperations

Operation of Redis Hyperloglog type data, such as: Pfadd,pfcount, ...

Geooperations

Operation of Redis geospatial type data such as: Geoadd,georadius,...)

Key binding operation

Boundvalueoperations

Redis string (or value) key binding operation

Boundlistoperations

Redis List Key binding operations

Boundsetoperations

Redis Set Key binding operation

Boundzsetoperations

Redis Zset (or sorted Set) key binding operation

Boundhashoperations

Redis Hash Key binding operation

Boundgeooperations

Redis Geospatial Key Binding operation

Once configured, the template is thread-safe and can be reused by multiple instances.


Out of the box, Redistemplate uses a Java-based serializer to do most of the work. This means that any object that reads and writes through the template will be serialized/deserialized through Java. The serialization mechanism of the template is also easy to change, and the Redis module provides a variety of implementations available in the Org.springframework.data.redis.serializer package, see serializers for details. You can also set the Enabledefaultserializer property to false by setting the other serialization implementation to NULL, and use the redistemplate with the native byte array. Note that the template's key is not allowed as a null value unless the underlying serializer can accept it. For more information on serializers, please read Javadoc.


===================================================================


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.