Search in sources :

Example 1 with CacheManagerImpl

use of com.github.benmanes.caffeine.jcache.CacheManagerImpl in project caffeine by ben-manes.

the class CaffeineCachingProvider method getCacheManager.

@Override
public CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties) {
    URI managerURI = getManagerUri(uri);
    ClassLoader managerClassLoader = getManagerClassLoader(classLoader);
    synchronized (cacheManagers) {
        Map<URI, CacheManager> cacheManagersByURI = cacheManagers.computeIfAbsent(managerClassLoader, any -> new HashMap<>());
        return cacheManagersByURI.computeIfAbsent(managerURI, any -> {
            Properties managerProperties = (properties == null) ? getDefaultProperties() : properties;
            return new CacheManagerImpl(this, managerURI, managerClassLoader, managerProperties);
        });
    }
}
Also used : CacheManager(javax.cache.CacheManager) CacheManagerImpl(com.github.benmanes.caffeine.jcache.CacheManagerImpl) Properties(java.util.Properties) URI(java.net.URI)

Aggregations

CacheManagerImpl (com.github.benmanes.caffeine.jcache.CacheManagerImpl)1 URI (java.net.URI)1 Properties (java.util.Properties)1 CacheManager (javax.cache.CacheManager)1