Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize the Integration of SpringBoot and Redis

Shulou Source: shulou.com Published: 2022-05-31 13:40:53 09月24日 Update

This article mainly introduces the SpringBoot integration Redis how to achieve the relevant knowledge, detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that everyone will have a harvest after reading this SpringBoot integration Redis how to achieve the article, let's take a look at it.

1. Introducing Dependency

org.springframework.bootspring-boot-starter-data-redis2.4.4

Second, background code:

spring.redis.database= 0spring.redis.host =192.168.1.xxxspring.redis.port=8099spring.redis.jedis.pool.max-active=8spring. redis. jedis. pool.max-wait=-1 msspring.redis.jedis. pool.max-idle=8spring.redis.jedis.pool.min-idle=0spring.redis.timeout=0@Controller@Api(tags = "Book Data Interface")@EnableCaching//Enable caching public class BookController {} @Cacheable(value = "book_id")//Use caching @Overridepublic Book getBookById(Integer id) { System.out.println("Query from database... ");return bookMapper.getBookById(id); } About "SpringBoot integration Redis how to achieve" The content of this article is introduced here, thank you for reading! I believe everyone has a certain understanding of the knowledge of "SpringBoot Integration Redis How to Realize." If you still want to learn more knowledge, please pay attention to the industry information channel.

Tags: Integration knowledge content data articles cache books code value background interface easy to operate database article easy to understand more look industry information information channel Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn NVidia Shulou Information MariaDB Apple