All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bardframework.commons.waf.RequestCallCounterRedis Maven / Gradle / Ivy

The newest version!
package org.bardframework.commons.waf;

import org.springframework.data.redis.core.RedisTemplate;

import java.util.concurrent.TimeUnit;

public class RequestCallCounterRedis implements RequestCallCounter {

    private final RedisTemplate redisTemplate;


    public RequestCallCounterRedis(RedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    @Override
    public Long increment(String key) {
        return redisTemplate.opsForValue().increment(key, 1);
    }

    @Override
    public void expire(String key, int expiration, TimeUnit unit) {
        redisTemplate.expire(key, expiration, unit);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy