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

querqy.elasticsearch.Caches Maven / Gradle / Ivy

There is a newer version: 1.7.es8150.0
Show newest version
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