获取所有的KEY,以及删除,通过KEYS获取所有数据 public static final String str = "room:create:"; //获取key前缀room:create:所有的key Set keys = stringRedisTemplate.keys(str + "*"); for(String key : keys){ //System.out.println(key); } List strings = stringRedisTemplate.opsForValue().multiGet(keys); for (int i = 0; i < strings.size(); i++){ // System.out.println(strings.get(i)); } //批量删除 //stringRedisTemplate.delete(keys); List t1s = JSONUtils.parseArray(strings.toString(), T1.class);
文章知识点与官