querqy.elasticsearch.Caches Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of querqy-elasticsearch Show documentation
Show all versions of querqy-elasticsearch Show documentation
Querqy library for query rewriting: Querqy for Elasticsearch
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