package io.ebeaninternal.server.core;
import io.ebean.annotation.Cache;
public class CacheOptions {
public static final CacheOptions NO_CACHING = new CacheOptions();
public static final CacheOptions INVALIDATE_QUERY_CACHE = new CacheOptions(true);
private final boolean invalidateQueryCache;
private final boolean enableBeanCache;
private final boolean enableQueryCache;
private final boolean readOnly;
private final String[] naturalKey;
private CacheOptions() {
invalidateQueryCache = false;
enableBeanCache = false;
enableQueryCache = false;
readOnly = false;
naturalKey = null;
}
private CacheOptions(boolean invalidateQueryCache) {
this.invalidateQueryCache = invalidateQueryCache;
enableBeanCache = false;
enableQueryCache = false;
readOnly = false;
naturalKey = null;
}
public CacheOptions(Cache cache, String[] naturalKey) {
invalidateQueryCache = false;
enableBeanCache = cache.enableBeanCache();
enableQueryCache = cache.enableQueryCache();
readOnly = cache.readOnly();
this.naturalKey = naturalKey;
}
public boolean isInvalidateQueryCache() {
return invalidateQueryCache;
}
public boolean isEnableBeanCache() {
return enableBeanCache;
}
public boolean isEnableQueryCache() {
return enableQueryCache;
}
public boolean isReadOnly() {
return readOnly;
}
public String[] getNaturalKey() {
return naturalKey;
}
}