知乎专栏 |
目录
https://docs.spring.io/spring-boot/docs/current/reference/html/io.html#io.caching.provider.redis
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> </dependency>
使用 Redis
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency>
spring.data.redis.host=cch.netkiller.cn spring.data.redis.port=6379 spring.data.redis.password=passw0rd spring.data.redis.database=10 spring.data.redis.timeout=30000 spring.data.redis.lettuce.pool.max-active=8 spring.data.redis.lettuce.pool.max-wait=-1 spring.data.redis.lettuce.pool.max-idle=8 spring.data.redis.lettuce.pool.min-idle=0 spring.cache.type=redis spring.cache.redis.time-to-live=3600000 spring.cache.redis.cache-null-values=true