io.quarkus.cache.runtime.AbstractCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-cache Show documentation
Show all versions of quarkus-cache Show documentation
Enable application data caching in CDI beans
package io.quarkus.cache.runtime;
import io.quarkus.cache.Cache;
import io.quarkus.cache.DefaultCacheKey;
public abstract class AbstractCache implements Cache {
public static final String NULL_KEYS_NOT_SUPPORTED_MSG = "Null keys are not supported by the Quarkus application data cache";
private Object defaultKey;
@Override
public Object getDefaultKey() {
if (defaultKey == null) {
defaultKey = new DefaultCacheKey(getName());
}
return defaultKey;
}
@Override
@SuppressWarnings("unchecked")
public T as(Class type) {
if (type.isInstance(this)) {
return (T) this;
} else {
throw new IllegalStateException("This cache is not an instance of " + type.getName());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy