当前位置: 首页>>代码示例>>Java>>正文


Java ShardedJedis.incr方法代码示例

本文整理汇总了Java中redis.clients.jedis.ShardedJedis.incr方法的典型用法代码示例。如果您正苦于以下问题:Java ShardedJedis.incr方法的具体用法?Java ShardedJedis.incr怎么用?Java ShardedJedis.incr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redis.clients.jedis.ShardedJedis的用法示例。


在下文中一共展示了ShardedJedis.incr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: increment

import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Override
public long increment(final String key, final int expire, final Callback<Long> callback) {
	checkParameters(key, callback);
	final ShardedJedis jedis = getJedis();

	long incr = jedis.incr(key);
	jedis.expire(key, expire);

	try {
		incr = callback.callback(incr);
	} catch (final Exception e) {
		throw new IncrementRedisException("method: increment, key: " + key + ", incr: " + incr, e);
	}

	returnResource(jedis);
	return incr;
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:18,代码来源:RedisServiceImpl.java

示例2: checkJedisIsReusedWhenReturned

import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Test
public void checkJedisIsReusedWhenReturned() {
  ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "0");
  pool.returnResource(jedis);

  jedis = pool.getResource();
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:13,代码来源:ShardedJedisPoolTest.java

示例3: checkPoolRepairedWhenJedisIsBroken

import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Test
public void checkPoolRepairedWhenJedisIsBroken() {
  ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.disconnect();
  pool.returnBrokenResource(jedis);

  jedis = pool.getResource();
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:13,代码来源:ShardedJedisPoolTest.java

示例4: checkPoolOverflow

import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Test(expected = JedisException.class)
public void checkPoolOverflow() {
  GenericObjectPoolConfig config = new GenericObjectPoolConfig();
  config.setMaxTotal(1);
  config.setBlockWhenExhausted(false);

  ShardedJedisPool pool = new ShardedJedisPool(config, shards);

  ShardedJedis jedis = pool.getResource();
  jedis.set("foo", "0");

  ShardedJedis newJedis = pool.getResource();
  newJedis.incr("foo");
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:15,代码来源:ShardedJedisPoolTest.java

示例5: checkFailedJedisServer

import redis.clients.jedis.ShardedJedis; //导入方法依赖的package包/类
@Test
public void checkFailedJedisServer() {
  ShardedJedisPool pool = new ShardedJedisPool(new GenericObjectPoolConfig(), shards);
  ShardedJedis jedis = pool.getResource();
  jedis.incr("foo");
  pool.returnResource(jedis);
  pool.destroy();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:9,代码来源:ShardedJedisPoolTest.java


注:本文中的redis.clients.jedis.ShardedJedis.incr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。