Springboot Integrated Redis First practice

Source: Internet
Author: User
Tags redis desktop manager redis server

 Redis is an open source (BSD licensed), memory-stored data structure server that can be used as a database, cache, and Message Queuing agent.

Sometimes, in order to improve the performance of the entire Web site, the data that is frequently accessed is cached at development time, which can improve the efficiency of data loading when the data interface is called.

This article will integrate Redis in the boot project, caching common data to REDIS servers and improving the concurrency of common services.

Project Environment:

jdk1.8

maven3.5

Spring Boot 2.0.4.RELEASE

Spring-boot-starter-data-redis 2.0.4.RELEASE

Redis3.2

I. Installing Redis

Follow "Terry's private Tutorial" public number reply Redis get

  Unzip to local open Redis-cli.exe run after download

  

After a successful run, you can view it through the Redis Desktop Manager connection

  

Two. Integrated Redis

This project caches data in Redis when invoking weather interface data

Specific implementation:

Introduction of stringredistemplate, increased operation on Redis servers

Set Cache time

  

redis is stored in key-value format, so calling This method will call the address as key, call data value, each call is first to determine if there is a key in Redis, if there is this key, Direct else will pull the data out,

Re-fetch the data if it does not exist and initialize it to Redis

  

Third, the results of the operation

Logs allow you to discover that data is being cached in the Redis server

  

  through Redis Desktop Manager View

 Integrated Redis success, if you have questions, please follow the public number "Terry Private tutorial" message

  

  

  

 

  

Springboot Integrated Redis First practice

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.