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

io.quarkus.cache.runtime.CacheManagerImpl Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
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