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


Java Transaction.hincrBy方法代码示例

本文整理汇总了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;

}
 
开发者ID:longcoding,项目名称:undefined-gateway,代码行数:20,代码来源:ApplicationRatelimitInterceptor.java

示例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;
}
 
开发者ID:longcoding,项目名称:undefined-gateway,代码行数:12,代码来源:ServiceCapacityInterceptor.java

示例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());
}
 
开发者ID:vdurmont,项目名称:fake-jedis,代码行数:21,代码来源:FakeTransactionTest.java

示例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();
}
 
开发者ID:vdurmont,项目名称:fake-jedis,代码行数:13,代码来源:FakeTransactionTest.java


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