K
- the type of the Cache
keysV
- the type of the Cache
valuespublic class PassThroughCacheConfiguration<K,V> extends Object implements CoherenceBasedConfiguration<K,V>
Configuration
for a
Cache
based on an existing Coherence
NamedCache
.
Cache
s produced according to this configuration are not expected to be
JCache-compliant. They simply provide a JCache interface (aka: wrapper) over
native Coherence NamedCache
s.
Constructor and Description |
---|
PassThroughCacheConfiguration()
Constructs a
PassThroughCacheConfiguration that defaults
to using the Cache name as the underlying
NamedCache name with Object-based key and
value types. |
PassThroughCacheConfiguration(javax.cache.configuration.CompleteConfiguration<K,V> configuration)
Constructs a PassThroughConfiguration based on a JCache
CompleteConfiguration . |
PassThroughCacheConfiguration(PassThroughCacheConfiguration<K,V> configuration)
Constructs a
PassThroughCacheConfiguration based on a
provided PassThroughCacheConfiguration . |
Modifier and Type | Method and Description |
---|---|
CoherenceBasedCache<K,V> |
createCache(CoherenceBasedCacheManager manager,
String sJCacheName)
Creates a
CoherenceBasedCache based on the current state of
the CoherenceBasedConfiguration , to be owned by
the specified CoherenceBasedCacheManager . |
void |
destroyCache(CoherenceBasedCacheManager manager,
String name)
Destroy a
CoherenceBasedCache implementation. |
Class<K> |
getKeyType() |
String |
getNamedCacheName()
Obtains the desired mapping of a JCache
Cache name to an
Coherence NamedCache . |
Class<V> |
getValueType() |
boolean |
isStoreByValue() |
PassThroughCacheConfiguration<K,V> |
setNamedCacheName(String sNamedCacheName)
Sets the desired Coherence
NamedCache
name to map to when specifying a JCache Cache name |
PassThroughCacheConfiguration<K,V> |
setTypes(Class<K> clzKey,
Class<V> clzValue)
Sets the expected type of keys and values for a
PassThroughCache
configured with this Configuration . |
public PassThroughCacheConfiguration()
PassThroughCacheConfiguration
that defaults
to using the Cache
name as the underlying
NamedCache
name with Object-based key and
value types.public PassThroughCacheConfiguration(javax.cache.configuration.CompleteConfiguration<K,V> configuration)
CompleteConfiguration
.
WARNING: This is a lossy construction and a warning will be emitted when this method
is called. Most CompleteConfiguration
properties are ignored. Native Coherence
configuration must be used when using PassThroughCache
;
configuration
- configuration properties of a JCache CompleteConfiguration
. Note
most of these properties are ignored.public PassThroughCacheConfiguration(PassThroughCacheConfiguration<K,V> configuration)
PassThroughCacheConfiguration
based on a
provided PassThroughCacheConfiguration
.configuration
- the PassThroughCacheConfiguration
public PassThroughCacheConfiguration<K,V> setNamedCacheName(String sNamedCacheName)
NamedCache
name to map to when specifying a JCache Cache
namesNamedCacheName
- the desired NamedCache
(or null
to default to the JCache name)PassThroughCacheConfiguration
to support fluent-style callspublic String getNamedCacheName()
Cache
name to an
Coherence NamedCache
.NamedCache
name to usepublic PassThroughCacheConfiguration<K,V> setTypes(Class<K> clzKey, Class<V> clzValue)
PassThroughCache
configured with this Configuration
. Setting both to
Object.class
means type-safety checks are not required
(which is the default)clzKey
- the expected key typeclzValue
- the expected value typePassThroughCacheConfiguration
to permit fluent-style method callsNullPointerException
- should the key or value type be nullpublic boolean isStoreByValue()
public CoherenceBasedCache<K,V> createCache(CoherenceBasedCacheManager manager, String sJCacheName) throws IllegalArgumentException
CoherenceBasedConfiguration
CoherenceBasedCache
based on the current state of
the CoherenceBasedConfiguration
, to be owned by
the specified CoherenceBasedCacheManager
.createCache
in interface CoherenceBasedConfiguration<K,V>
manager
- the owning CoherenceBasedCacheManager
sJCacheName
- the name of the Cache
to be configuredCoherenceBasedCache
IllegalArgumentException
- when a Cache
can't be created
based on the current CoherenceBasedConfiguration
public void destroyCache(CoherenceBasedCacheManager manager, String name)
CoherenceBasedConfiguration
CoherenceBasedCache
implementation.destroyCache
in interface CoherenceBasedConfiguration<K,V>
manager
- the owning CoherenceBasedCacheManager
name
- the name of the Cache
to be destroyed