本文整理汇总了Java中redis.clients.jedis.Transaction.hincrBy方法的典型用法代码示例。如果您正苦于以下问题:Java Transaction.hincrBy方法的具体用法?Java Transaction.hincrBy怎么用?Java Transaction.hincrBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.clients.jedis.Transaction
的用法示例。
在下文中一共展示了Transaction.hincrBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setJedisMultiCommand
import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Override
public Map<String, Response<Long>> setJedisMultiCommand(Transaction jedisMulti) {
Response<Long> applicationDailyRateLimit =
jedisMulti.hincrBy(Const.REDIS_APP_RATELIMIT_DAILY, this.requestInfo.getAppId(), -1);
Response<Long> applicationMinutelyRateLimit =
jedisMulti.hincrBy(Const.REDIS_APP_RATELIMIT_MINUTELY, this.requestInfo.getAppId(), -1);
Response<Long> applicationDailyRateLimitTTL = jedisMulti.ttl(Const.REDIS_APP_RATELIMIT_DAILY);
Response<Long> applicationMinutelyRateLimitTTL = jedisMulti.ttl(Const.REDIS_APP_RATELIMIT_MINUTELY);
Map<String, Response<Long>> appRatelimit = Maps.newHashMap();
appRatelimit.put(Const.REDIS_APP_RATELIMIT_DAILY, applicationDailyRateLimit);
appRatelimit.put(Const.REDIS_APP_RATELIMIT_MINUTELY, applicationMinutelyRateLimit);
appRatelimit.put(Const.REDIS_APP_RATELIMIT_DAILY_TTL, applicationDailyRateLimitTTL);
appRatelimit.put(Const.REDIS_APP_RATELIMIT_MINUTELY_TTL, applicationMinutelyRateLimitTTL);
return appRatelimit;
}
示例2: setJedisMultiCommand
import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Override
public Map<String, Response<Long>> setJedisMultiCommand(Transaction jedisMulti) {
Response<Long> serviceDailyRatelimit = jedisMulti.hincrBy(Const.REDIS_SERVICE_CAPACITY_DAILY, this.requestInfo.getServiceId(), -1);
Response<Long> serviceDailyTTL = jedisMulti.ttl(Const.REDIS_SERVICE_CAPACITY_DAILY);
Map<String, Response<Long>> serviceRatelimit = Maps.newHashMap();
serviceRatelimit.put(Const.REDIS_SERVICE_CAPACITY_DAILY, serviceDailyRatelimit);
serviceRatelimit.put(Const.REDIS_SERVICE_CAPACITY_DAILY_TTL, serviceDailyTTL);
return serviceRatelimit;
}
示例3: hincrby
import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Test public void hincrby() {
// GIVEN
Transaction tr = this.jedis.multi();
// WHEN
Response<Long> result1 = tr.hincrBy(KEY, FIELD, 3);
Response<Long> result2 = tr.hincrBy(KEY, FIELD, 4);
List<Object> results = tr.exec();
// THEN
String value = this.jedis.hget(KEY, FIELD);
assertEquals("7", value);
assertEquals(2, results.size());
assertEquals(3, (long) results.get(0));
assertEquals(7, (long) results.get(1));
assertEquals(3, (long) result1.get());
assertEquals(7, (long) result2.get());
}
示例4: responseget_before_exec
import redis.clients.jedis.Transaction; //导入方法依赖的package包/类
@Test public void responseget_before_exec() {
// GIVEN
Transaction tr = this.jedis.multi();
// THEN
this.expectedException.expect(JedisDataException.class);
this.expectedException.expectMessage("Please close pipeline or multi block before calling this method.");
// WHEN
Response<Long> response = tr.hincrBy(KEY, FIELD, 3);
response.get();
}