RedisTemplate中opsForHash()
1、put(H key, HK hashKey, HV value) //新增hashMap值
redisTemplate.opsForHash().put("Person","name","ligang");
redisTemplate.opsForHash().put("Person","age","31");
redisTemplate.opsForHash().put("Person","slary",10000);
2、values(H key) // 获取指定变量中的hashMap值。
List<Object> hashList = redisTemplate.opsForHash().values("Person");
System.out.println(Arrays.deepToString(hashList.toArray()); //[6000, ligang, 31]
3、entries(H key) // 获取变量中的键值对。
Map<Object,Object> map = redisTemplate.opsForHash().entries("Person"); //{"slary":6000,"name":"ligang","age":"31"}
4、get(H key, Object hashKey)//获取变量中的指定map键是否有值,如果存在该map键则获取值,没有则返回null。
Object mapValue = redisTemplate.opsForHash