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

querqy.elasticsearch.Caches Maven / Gradle / Ivy

package querqy.elasticsearch;

import org.elasticsearch.common.cache.Cache;
import org.elasticsearch.common.cache.CacheBuilder;
import org.elasticsearch.core.TimeValue;

public class Caches {

    public static  Cache buildCache(final TimeValue expireAfterWrite, final TimeValue expireAfterAccess) {

        final CacheBuilder builder = CacheBuilder.builder();
        if (expireAfterWrite.nanos() > 0) {
            builder.setExpireAfterWrite(expireAfterWrite);
        }
        if (expireAfterAccess.nanos() > 0) {
            builder.setExpireAfterAccess(expireAfterAccess);
        }
        return builder.build();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy