<dependencies> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> <type>jar</type> <scope>compile</scope> </dependency> </dependencies>
Jedis jedis = new Jedis("localhost");
jedis.set("foo", "bar");
String value = jedis.get("foo");
JedisPoolConfig config= new JedisPoolConfig();// Jedis池配置文件 config.setMaxTotal(1024); // 最大连接实例数 config.setMaxIdle(200); // 最大闲置实例数 config.setMaxWaitMillis(15000); // 等待可用连接的最大时间 config.setTestOnBorrow(true); // JedisPool pool = new JedisPool(config,ADDR,PORT,TIMEOUT,AUTH); // 创建一个Jedis连接池
Jedis jedis = pool.getResource(); // 取出实例
jedis.set("foo","bar");
jedis.close(); // 归还实例资源给连接池
Jedis jedis = new Jedis("localhost",6379,15000);
Pipeline pip = jedis.pipelined();
Map<String,String> mp = new HashMap<String, String>();
long start = System.currentTimeMillis();
for (int i = 0 ; i < 10000 ; i++){
mp.clear();
mp.put("k"+i,"v"+i);
pip.hmset("keys"+i,mp);
}
Jedis jedis = new Jedis("localhost",6379,15000);
Map<String,String> mp = new HashMap<String, String>();
long start = System.currentTimeMillis();
for (int i = 0 ; i < 10000 ; i++){
mp.clear();
mp.put("k"+i,"v"+i);
jedis.hmset("keys"+i,mp);
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有