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

org.infinispan.spring.provider.SpringEmbeddedCacheManager Maven / Gradle / Ivy

There is a newer version: 10.0.0.Alpha1
Show newest version
package org.infinispan.spring.provider;

import java.util.Collection;

import org.infinispan.manager.EmbeddedCacheManager;
import org.springframework.cache.CacheManager;
import org.springframework.util.Assert;

/**
 * 

* A {@link org.springframework.cache.CacheManager CacheManager} implementation that is * backed by an {@link org.infinispan.manager.EmbeddedCacheManager * Infinispan EmbeddedCacheManager} instance. *

*

* Note that this CacheManager does support adding new * {@link org.infinispan.Cache Caches} at runtime, i.e. Caches added * programmatically to the backing EmbeddedCacheManager after this * CacheManager has been constructed will be seen by this CacheManager. *

* * @author Olaf Bergner * @author Marius Bogoevici * */ public class SpringEmbeddedCacheManager implements CacheManager { private final EmbeddedCacheManager nativeCacheManager; /** * @param nativeCacheManager Underlying cache manager */ public SpringEmbeddedCacheManager(final EmbeddedCacheManager nativeCacheManager) { Assert.notNull(nativeCacheManager, "A non-null instance of EmbeddedCacheManager needs to be supplied"); this.nativeCacheManager = nativeCacheManager; } @Override public SpringCache getCache(final String name) { return new SpringCache(this.nativeCacheManager.getCache(name)); } @Override public Collection getCacheNames() { return this.nativeCacheManager.getCacheNames(); } /** * Return the {@link org.infinispan.manager.EmbeddedCacheManager * org.infinispan.manager.EmbeddedCacheManager} that backs this * CacheManager. * * @return The {@link org.infinispan.manager.EmbeddedCacheManager * org.infinispan.manager.EmbeddedCacheManager} that backs this * CacheManager */ public EmbeddedCacheManager getNativeCacheManager() { return this.nativeCacheManager; } /** * Stop the {@link EmbeddedCacheManager EmbeddedCacheManager} this * CacheManager delegates to. */ public void stop() { this.nativeCacheManager.stop(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy