Redisson之RMap

package bright.redisson;

import java.util.concurrent.TimeUnit;

import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.api.RMap;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;

public class RMapTest {
	
	public static void main(String[] args) {
		Config config = new Config();
		
		SingleServerConfig singleServerConfig = config.useSingleServer();
		singleServerConfig.setAddress("redis://127.0.0.1:6579");
		singleServerConfig.setPassword("9client!");
		
		RedissonClient redissonClient = Redisson.create(config);
		
		RMap map = redissonClient.getMap("myMap");
		
		map.put("aaaa", "1234");
		map.put("bbbb", "4321");
		
		System.out.println(map.get("bbbb"));
		
		redissonClient.shutdown();
	}

}

注意,要运行本程序,需要以下jar包:

1、jackson-annotations-2.9.6.jar

2、jackson-core-2.9.6.jar

3、jackson-databind-2.9.6.jar

4、jackson-dataformat-yaml-2.9.6.jar

5、log4j-1.2.17.jar

6、netty-all-4.1.28.Final.jar

7、redisson-3.7.5.jar

8、slf4j-api-1.7.25.jar

你可能感兴趣的:(Redisson)