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

com.github.bootfastconfig.cache.redis.RedisBuilder Maven / Gradle / Ivy

Go to download

Parent pom providing dependency and plugin management for applications built with Maven

The newest version!
package com.github.bootfastconfig.cache.redis;

import com.github.bootfastconfig.cache.CacheBuilder;
import com.github.bootfastconfig.cache.Duration;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.redis.cache.RedisCacheConfiguration;

import java.util.concurrent.TimeUnit;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RedisBuilder implements CacheBuilder {


    private String name;

    private Duration expireAfterAccess = new Duration(120, TimeUnit.SECONDS);

    private RedisCacheConfiguration defaultCacheConfig;


    @Override
    public RedisCacheConfiguration get() {
        TimeUnit unit = expireAfterAccess.getUnit();
        return defaultCacheConfig.entryTtl(java.time.Duration.ofSeconds(unit.toSeconds(expireAfterAccess.getDuration())));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy