完整代码
public class App { public static void main(String[] args) { System.out.println("Hello World!"); //创建连接 Config config = new Config(); config.useSingleServer().setAddress("redis://192.168.1.109:6379");//设置链接地址 RedissonClient redisson = Redisson.create(config); RBucket<String> bucket = redisson.getBucket("simpleObject"); bucket.set("你的对象");//设置值 RMap<String,String>map = redisson.getMap("simpleMap"); map.put("mapKey","你的映射值");打印值 String objectValue = bucket.get(); System.out.println("储存的对象值是: "+objectValue);//设置值 String mapValue = map.get("mapKey"); System.out.println("储存的映射值"+mapValue);//打印值 redisson.shutdown(); } }