public class SpringDynamicCacheManager extends SpringCacheManager
SpringCacheManager that adds an option to
emulate dynamic cache creation for you Spring-based applications.
All the data will be actually cached in one Ignite cache. It's
name should be provided to this cache manager via
setDataCacheName(String) configuration property.
Under the hood, this cache manager will create a cache projection
for each cache name provided in org.springframework.cache.annotation.Cacheable,
org.springframework.cache.annotation.CachePut,
etc. annotations. Note that you're still able to use caches configured in
Ignite configuration. Cache projection will be created only
cache with provided name doesn't exist.
SpringDynamicCacheManager inherits all configuration
properties from SpringCacheManager (see it's JavaDoc
for more information on how to enable Ignite-based caching in
a Spring application).
Additionally you will need to set a Ignite cache name where the data for
all dynamically created caches will be stored. By default its name
is null, which refers to default cache. Here is the example
of how to configure a named cache:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
<-- Provide configuration file path -->
<bean id="cacheManager" class="org.apache.ignite.cache.spring.GridSpringCacheManager">
<property name="dataCacheName" value="myDataCache"/>
</bean>
...
</beans>
SpringCacheManagergrid| Constructor and Description |
|---|
SpringDynamicCacheManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
org.springframework.cache.Cache |
getCache(String name) |
Collection<String> |
getCacheNames() |
String |
getDataCacheName()
Sets data cache name.
|
void |
setDataCacheName(String dataCacheName)
Gets data cache name.
|
getConfiguration, getConfigurationPath, getGridName, setConfiguration, setConfigurationPath, setGridNamepublic String getDataCacheName()
public void setDataCacheName(String dataCacheName)
dataCacheName - Data cache name.public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanafterPropertiesSet in class SpringCacheManagerExceptionpublic org.springframework.cache.Cache getCache(String name)
getCache in interface org.springframework.cache.CacheManagergetCache in class SpringCacheManagerpublic Collection<String> getCacheNames()
getCacheNames in interface org.springframework.cache.CacheManagergetCacheNames in class SpringCacheManager
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015