Example usage for org.springframework.data.redis.support.atomic RedisAtomicLong RedisAtomicLong

List of usage examples for org.springframework.data.redis.support.atomic RedisAtomicLong RedisAtomicLong

Introduction

In this page you can find the example usage for org.springframework.data.redis.support.atomic RedisAtomicLong RedisAtomicLong.

Prototype

private RedisAtomicLong(String redisCounter, RedisOperations<String, Long> template,
            @Nullable Long initialValue) 

Source Link

Usage

From source file:com.miko.demo.mongo.service.RedisInitTest.java

@Test
public void testAtomicCounters() {
    RedisAtomicLong counter = new RedisAtomicLong("miko-spring-mongo:counter-test", connectionFactory, 0);
    Long l = counter.incrementAndGet();

    assertThat(l, is(greaterThan(0L)));/*from w  ww .  ja v  a 2s .c o m*/
}

From source file:com.miko.demo.postgresql.service.RedisInitTest.java

@Test
public void testAtomicCounters() {
    RedisAtomicLong counter = new RedisAtomicLong("miko-spring-postgresql:counter-test", connectionFactory, 0);
    Long l = counter.incrementAndGet();

    assertThat(l, is(greaterThan(0L)));//w w  w . j  av a  2  s .  co  m
}