redis的五种数据结构
五种数据结构
1、string
2、hash(类似map)
3、list
4、set
5、有序set
jedisClient.set("redis_test", "value"); String redisStr = jedisClient.get("redis_test"); jedisClient.hset("rule","name","chi.zhang04"); jedisClient.hset("rule","age","27"); jedisClient.hset("rule","sex","male"); Map<String,String> map = jedisClient.hgetall("rule"); jedisClient.lpush("list", "l1","l2","l2","l3"); List<String> list = jedisClient.lrange("list", 0l, 3l); jedisClient.sadd("redis_set", "set1", "set2", "set3","set3"); Set<String> str = jedisClient.smembers("redis_set"); System.out.println(str); Map<String,Double> maps = Maps.newHashMap(); maps.put("m1", 22d); maps.put("m2", 23d); maps.put("m3", 2d); maps.put("m4", 77d); maps.put("m7", 78d); jedisClient.zadd("zsort", maps); Set<String> strings = jedisClient.zrevrangeByScore("zsort", 100d,2d); System.out.println(strings);