public final class ObjectGridCache extends Object implements Cache, InitializingBean
This class is a WebSphere eXtreme Scale implementation of the Spring Framework's Cache
interface.
Users must provide a name and a ObjectGridClientBean to configure this cache. The ObjectMap name
is optional when using the provided XML configuration files.
This implementation allows for the storage of null values and does not support null keys.
The following Spring Inversion of Control (IoC) container configuration snippet creates two caches, named default and books hosted by the catalog service domain with connection end-points of host1:2809,host2:2809.
<bean id="wxsCSDomain" class="com.ibm.websphere.objectgrid.spring.ObjectGridCatalogServiceDomainBean"
p:catalog-service-endpoints="host1:2809,host2:2809" />
<bean id="wxsGridClient" class="com.ibm.websphere.objectgrid.spring.ObjectGridClientBean"
p:catalog-service-domain-ref="wxsCSDomain" />
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
<property name="caches">
<set>
<bean class="com.ibm.websphere.objectgrid.spring.ObjectGridCache"
p:name="default"
p:object-grid-client-ref="wxsGridClient" />
<bean class="com.ibm.websphere.objectgrid.spring.ObjectGridCache"
p:name="books"
p:object-grid-client-ref="wxsGridClient" />
</set>
</property>
</bean>
Cache.ValueWrapper| Constructor and Description |
|---|
ObjectGridCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Initializes this cache.
|
void |
clear()
Clears all entries from the cache.
|
void |
evict(Object key)
Evicts the entry at the given key.
|
Cache.ValueWrapper |
get(Object key)
Retrieves the object from the cache at the given key.
|
<T> T |
get(Object key,
Class<T> type) |
String |
getName()
Returns the name of the cache.
|
Object |
getNativeCache()
This implementation returns
null. |
void |
put(Object key,
Object value)
Creates an entry in the cache.
|
Cache.ValueWrapper |
putIfAbsent(Object key,
Object value) |
void |
setMapName(String mapName)
Sets the ObjectMap name.
|
void |
setName(String name)
Sets the cache name.
|
void |
setObjectGridClient(ObjectGridClientBean objectGridClient)
Sets the
ObjectGridClientBean to use. |
public void afterPropertiesSet()
throws Exception
IllegalArgumentException if setObjectGridClient(ObjectGridClientBean) or
setName(String) have not been called prior.afterPropertiesSet in interface InitializingBeanException - if setObjectGridClient(ObjectGridClientBean) or setName(String)
have not been called prior or an error occurs initializing the cache.InitializingBean.afterPropertiesSet()public String getName()
getName in interface CacheCache.getName()public void setName(String name)
name - The cache name.getName()public void setMapName(String mapName)
mapName - The name of the ObjectMappublic void setObjectGridClient(ObjectGridClientBean objectGridClient)
ObjectGridClientBean to use.objectGridClient - The ObjectGridClientBean to usepublic Object getNativeCache()
null.getNativeCache in interface Cachenull.Cache.getNativeCache()public Cache.ValueWrapper get(Object key)
null if there is no mapping for the
key or if the key is nullget in interface Cachenull if there is no mapping or the key
is nullCache.get(java.lang.Object)public <T> T get(Object key, Class<T> type)
get in interface CacheCache.get(Object, Class)public void put(Object key, Object value)
null.put in interface CacheCache.put(java.lang.Object, java.lang.Object)public Cache.ValueWrapper putIfAbsent(Object key, Object value)
putIfAbsent in interface CacheCache.putIfAbsent(Object, Object)public void evict(Object key)
null this method does not evict any entries.evict in interface CacheCache.evict(java.lang.Object)public void clear()
clear in interface CacheCache.clear()