io.quarkus.cache.runtime.CacheManagerImpl 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 java.util.Collections;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import io.quarkus.cache.Cache;
import io.quarkus.cache.CacheManager;
/**
* This class is registered as an @ApplicationScoped synthetic bean at build time.
*/
public class CacheManagerImpl implements CacheManager {
private final Map caches;
private final Set cacheNames;
public CacheManagerImpl(Map caches) {
Objects.requireNonNull(caches);
this.caches = Collections.unmodifiableMap(caches);
cacheNames = Collections.unmodifiableSet(caches.keySet());
}
@Override
public Set getCacheNames() {
return cacheNames;
}
@Override
public Optional getCache(String name) {
if (name == null) {
return Optional.empty();
}
return Optional.ofNullable(caches.get(name));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy