1.redis常用通用命令
2.java项目中使用redis
jedis整合
@Test
void contextLoads() {
Jedis jedis = new Jedis("localhost",6379);
String name = jedis.hget("student", "name");
System.out.println(name);
jedis.close();
}
springboot整合
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
yml配置
spring:
redis:
host: localhost
port: 6379
#password: root
database: 0
jedis:
pool:
max-active: 8
max-wait: 1ms
max-idle: 4
min-idle: 0