@Test
public void testSetValue(){ redisTemplate.boundHashOps("namehash").put("a", "唐僧");
redisTemplate.boundHashOps("namehash").put("b", "悟空"); redisTemplate.boundHashOps("namehash").put("c", "八戒");
redisTemplate.boundHashOps("namehash").put("d", "沙僧");
}
@Test
public void testGetKeys(){
Set s = redisTemplate.boundHashOps("namehash").keys(); System.out.println(s);
}
@Test
public void testGetValues(){
List values = redisTemplate.boundHashOps("namehash").values(); System.out.println(values);
}
@Test
public void testGetValueByKey(){
Object object = redisTemplate.boundHashOps("namehash").get("b");
System.out.println(object);
}
@Test
public void testRemoveValueByKey(){ redisTemplate.boundHashOps("namehash").delete("c");
}
<!-- 缓 存 -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |