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

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

Go to download

The Infinispan Spring Integration project provides Spring integration for Infinispan, a high performance distributed cache. Its primary features are * An implementation of org.springframework.cache.CacheManager, Spring's central caching abstraction, backed by Infinispan's EmbeddedCacheManager. To be used if your Spring-powered application and Infinispan are colocated, i.e. running within the same VM. * An implementation of org.springframework.cache.CacheManager backed by Infinispan's RemoteCacheManager. To bes used if your Spring-powered application accesses Infinispan remotely, i.e. over the network. * An implementation of org.springframework.cache.CacheManager backed by a CacheContainer reference. To be used if your Spring- powered application needs access to a CacheContainer defined outside the application (e.g. retrieved from JNDI) * Spring namespace support allowing shortcut definitions for all the components above In addition, Infinispan Spring Integration offers various FactoryBeans for facilitating creation of Infinispan core classes - Cache, CacheManager, ... - within a Spring context.

There is a newer version: 8.2.12.Final
Show newest version
package org.infinispan.spring.provider;

import org.infinispan.client.hotrod.RemoteCacheManager;
import org.springframework.cache.Cache;
import org.springframework.util.Assert;

import java.util.Collection;

/**
 * 

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

* * @author Olaf Bergner * @author Marius Bogoevici * */ public class SpringRemoteCacheManager implements org.springframework.cache.CacheManager { private final RemoteCacheManager nativeCacheManager; /** * @param nativeCacheManager the underlying cache manager */ public SpringRemoteCacheManager(final RemoteCacheManager nativeCacheManager) { Assert.notNull(nativeCacheManager, "A non-null instance of EmbeddedCacheManager needs to be supplied"); this.nativeCacheManager = nativeCacheManager; } /** * @see org.springframework.cache.CacheManager#getCache(java.lang.String) */ @Override public Cache getCache(final String name) { return new SpringRemoteCache(this.nativeCacheManager.getCache(name)); } /** *

* As of Infinispan 4.2.0.FINAL org.infinispan.client.hotrod.RemoteCache does * not support retrieving the set of all cache names from the hotrod server. * This restriction may be lifted in the future. Currently, this operation will always throw an * UnsupportedOperationException. *

* * @see org.springframework.cache.CacheManager#getCacheNames() */ @Override public Collection getCacheNames() { throw new UnsupportedOperationException( "Operation getCacheNames() is currently not supported."); } /** * Return the {@link org.infinispan.client.hotrod.RemoteCacheManager * org.infinispan.client.hotrod.RemoteCacheManager} that backs this * SpringRemoteCacheManager. * * @return The {@link org.infinispan.client.hotrod.RemoteCacheManager * org.infinispan.client.hotrod.RemoteCacheManager} that backs this * SpringRemoteCacheManager */ public RemoteCacheManager getNativeCacheManager() { return this.nativeCacheManager; } /** * Start the {@link org.infinispan.client.hotrod.RemoteCacheManager * org.infinispan.client.hotrod.RemoteCacheManager} that backs this * SpringRemoteCacheManager. */ public void start() { this.nativeCacheManager.start(); } /** * Stop the {@link org.infinispan.client.hotrod.RemoteCacheManager * org.infinispan.client.hotrod.RemoteCacheManager} that backs this * SpringRemoteCacheManager. */ public void stop() { this.nativeCacheManager.stop(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy