com.ibm.websphere.cache
Interface DistributedMap
All Superinterfaces:
java.util.Map
All known implementing classes:
- public interface DistributedMap
- extends java.util.Map
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Method Summary
Modifier and Type | Method and Description |
---|---|
|
addAlias(java.lang.Object key,java.lang.Object[] aliasArray)
Adds an alias for the given key in the cache's mapping table.
|
|
addChangeListener(ChangeListener listener)
addChangeListener - adds a change listener for this DistributedMap.
|
|
addInvalidationListener(InvalidationListener listener)
addInvalidationListener - adds an invalidation listener for this DistributeMap.
|
|
containsKey(java.lang.Object key,boolean includeDiskCache)
Returns true if this map contains mapping for the specified key.
|
|
enableListener(boolean enable)
enableListener - enable or disable the invalidation and change listener support.
|
|
get(java.lang.Object key)
Returns the value to which this map maps the specified key.
|
|
getSharingPolicy()
getSharingPolicy - gets the sharing policy for DistributedMap.
|
|
invalidate(java.lang.Object key)
invalidate - invalidates the given key.
|
|
invalidate(java.lang.Object key,boolean wait)
invalidate - invalidates the given key.
|
|
isDRSBootstrapEnabled()
isDRSBootstrapEnabled - check whether DRS bootstrap for DistributedMap is enabled or not.
|
|
isEmpty(boolean includeDiskCache)
Returns true if this map contains no key-value mappings.
|
|
keySet(boolean includeDiskCache)
Returns a set view of the keys contained in this map.
|
|
put(java.lang.Object key,java.lang.Object value)
Associates the specified value with the specified key in this map
(optional operation).
|
|
put(java.lang.Object key,java.lang.Object value,int priority,int timeToLive,int inactivityTime,int sharingPolicy,java.lang.Object[] dependencyIds)
Associates the specified value with the specified key in this map
(optional operation).
|
|
put(java.lang.Object key,java.lang.Object value,int priority,int timeToLive,int sharingPolicy,java.lang.Object[] dependencyIds)
Associates the specified value with the specified key in this map
(optional operation).
|
|
removeAlias(java.lang.Object alias)
Removes an alias from the cache's mapping table.
|
|
removeChangeListener(ChangeListener listener)
removeChangeListener - removes a change listener for this DistributedMap.
|
|
removeInvalidationListener(InvalidationListener listener)
removeInvalidationListener - removes an invalidation listener for this DistributedMap.
|
|
setDRSBootstrap(boolean drsBootstrap)
setDRSBootstrap - Enables or disbales DRS bootstrap support
|
|
setPriority(int priority)
Sets the global priority for this map..
|
|
setSharingPolicy(int sharingPolicy)
setSharingPolicy - sets the sharing policy for DistributedMap.
|
|
setTimeToLive(int timeToLive)
Set the global time-to-live this this map.
|
|
size(boolean includeDiskCache)
Returns the total number of key-value mappings.
|
Methods inherited from interface java.util.Map |
---|
clear, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, putAll, remove, size, values |
Method Detail
setSharingPolicy
- void setSharingPolicy(int sharingPolicy)
setSharingPolicy - sets the sharing policy for DistributedMap.
Parameters:
sharingPolicy
- policy to set. Default is EntryInfo.NOT_SHARED See Also:
getSharingPolicy
- int getSharingPolicy()
getSharingPolicy - gets the sharing policy for DistributedMap.
setDRSBootstrap
- void setDRSBootstrap(boolean drsBootstrap)
setDRSBootstrap - Enables or disbales DRS bootstrap support
Parameters:
drsBootstrap
- - true (default) to enable DRS bootstrap support,
or false to ignore DRS bootstrap messages for this cache instance See Also:
isDRSBootstrapEnabled
- boolean isDRSBootstrapEnabled()
isDRSBootstrapEnabled - check whether DRS bootstrap for DistributedMap is enabled or not.
Returns:
returns the current DRS bootstrap of DistributedMap. True means enabled
See Also:
setTimeToLive
- void setTimeToLive(int timeToLive)
Set the global time-to-live this this map.
Parameters:
timeToLive
- setPriority
- void setPriority(int priority)
Sets the global priority for this map..
Parameters:
priority
- get
- java.lang.Object get(java.lang.Object key)
Returns the value to which this map maps the specified key. Returns
null
if the map contains no mapping for this key. A return
value of null
does not necessarily indicate that the
map contains no mapping for the key; it's also possible that the map
explicitly maps the key to null
. The containsKey
operation may be used to distinguish these two cases.
Specified by:
get
in interface java.util.Map
Parameters:
key
- key whose associated value is to be returned. Returns:
the value to which this map maps the specified key, or
null
if the map contains no mapping for this key. Throws:
java.lang.ClassCastException
- if the key is not of an inappropriate type for
this map. (Currently supports only String) java.lang.NullPointerException
- key is null
and this map does not
not permit null
keys. See Also:
Map.containsKey(Object)
put
- java.lang.Object put(java.lang.Object key,
- java.lang.Object value)
Associates the specified value with the specified key in this map
(optional operation). If the map previously contained a mapping for
this key, the old value is replaced. This method will use optional
metadata looked up from the cache configuration file. If no meta data
is found, the entrie is cached with an infinite timeout and the cache's
default priority.
Metadata found in the cache configuration is looked up via class name
and includes priority, timeout, and dependency ids.
Specified by:
put
in interface java.util.Map
Parameters:
key
- key with which the specified value is to be associated. value
- value to be associated with the specified key. Returns:
previous value associated with specified key, or
null
if there was no mapping for key. A null
return can
also indicate that the map previously associated null
with the specified key, if the implementation supports
null
values. Throws:
java.lang.UnsupportedOperationException
- if the put
operation is
not supported by this map. java.lang.ClassCastException
- if the class of the specified key or value
prevents it from being stored in this map. java.lang.IllegalArgumentException
- if some aspect of this key or value
prevents it from being stored in this map. java.lang.NullPointerException
- this map does not permit null
keys or values, and the specified key or value is
null
. put
- java.lang.Object put(java.lang.Object key,
- java.lang.Object value,
- int priority,
- int timeToLive,
- int sharingPolicy,
- java.lang.Object[] dependencyIds)
Associates the specified value with the specified key in this map
(optional operation). If the map previously contained a mapping for
this key, the old value is replaced.
Parameters:
key
- key with which the specified value is to be associated. value
- value to be associated with the specified key. priority
- the priority value for the cache entry. entries
with higher priority will remain in the cache longer
than those with a lower priority in the case of cache
overflow. timeToLive
- the time in seconds that the cache entry should remain
in the cache sharingPolicy
- how the cache entry should be shared in a cluster.
values are EntryInfo.NOT_SHARED, EntryInfo.SHARED_PUSH,
and EntryInfo.SHARED_PUSH_PULL. dependencyIds
- an optional set of dependency ids to associate with
the cache entry Returns:
previous value associated with specified key, or
null
if there was no mapping for key. A null
return can
also indicate that the map previously associated null
with the specified key, if the implementation supports
null
values. Throws:
java.lang.UnsupportedOperationException
- if the put
operation is
not supported by this map. java.lang.ClassCastException
- if the class of the specified key or value
prevents it from being stored in this map. java.lang.IllegalArgumentException
- if some aspect of this key or value
prevents it from being stored in this map. java.lang.NullPointerException
- this map does not permit null
keys or values, and the specified key or value is
null
. put
- java.lang.Object put(java.lang.Object key,
- java.lang.Object value,
- int priority,
- int timeToLive,
- int inactivityTime,
- int sharingPolicy,
- java.lang.Object[] dependencyIds)
Associates the specified value with the specified key in this map
(optional operation). If the map previously contained a mapping for
this key, the old value is replaced.
Parameters:
key
- key with which the specified value is to be associated. value
- value to be associated with the specified key. priority
- the priority value for the cache entry. entries
with higher priority will remain in the cache longer
than those with a lower priority in the case of cache
overflow. timeToLive
- the time in seconds that the cache entry should remain
in the cache inactivityTime
- the time in seconds that the cache entry should remain
in the cache if not accessed. This is reset once an entry is
accessed. sharingPolicy
- how the cache entry should be shared in a cluster.
values are EntryInfo.NOT_SHARED, EntryInfo.SHARED_PUSH,
EntryInfo.SHARED_PULL, and EntryInfo.SHARED_PUSH_PULL dependencyIds
- an optional set of dependency ids to associate with
the cache entry Returns:
previous value associated with specified key, or
null
if there was no mapping for key. A null
return can
also indicate that the map previously associated null
with the specified key, if the implementation supports
null
values. Throws:
java.lang.UnsupportedOperationException
- if the put
operation is
not supported by this map. java.lang.ClassCastException
- if the class of the specified key or value
prevents it from being stored in this map. java.lang.IllegalArgumentException
- if some aspect of this key or value
prevents it from being stored in this map. java.lang.NullPointerException
- this map does not permit null
keys or values, and the specified key or value is
null
. invalidate
- void invalidate(java.lang.Object key)
invalidate - invalidates the given key. If the key is
for a specific cache entry, then only that object is
invalidated. If the key is for a dependency id, then
all objects that share that dependency id will be
invalidated.
Parameters:
key
- the key which will be invalidated See Also:
Map.remove(Object key)
invalidate
- void invalidate(java.lang.Object key,
- boolean wait)
invalidate - invalidates the given key. If the key is
for a specific cache entry, then only that object is
invalidated. If the key is for a dependency id, then
all objects that share that dependency id will be
invalidated.
Parameters:
key
- the key which will be invalidated wait
- if true, then the method will not complete until the invalidation
has occured. if false, then the invalidation will occur in batch mode See Also:
Map.remove(Object key)
enableListener
- boolean enableListener(boolean enable)
enableListener - enable or disable the invalidation and change listener support.
You must call enableListener(true) before calling addInvalidationListner() or addChangeListener().
Parameters:
enable
- - true to enable support for invalidation and change listeners
or false to disable support for invalidation and change listeners Returns:
boolean "true" means listener support was successfully enabled or disabled.
"false" means this DistributedMap is configurated to use the listener's J2EE context for
event notification and the callback registration failed. In this case, the caller's thread
context will be used for event notification.
addInvalidationListener
- boolean addInvalidationListener( InvalidationListener listener)
addInvalidationListener - adds an invalidation listener for this DistributeMap.
Parameters:
listener
- the invalidation listener object Returns:
boolean "true" means the invalidation listener was successfully added.
"false" means either the passed listener object is null or listener support is not enable.
See Also:
removeInvalidationListener
- boolean removeInvalidationListener( InvalidationListener listener)
removeInvalidationListener - removes an invalidation listener for this DistributedMap.
Parameters:
listener
- the invalidation listener object Returns:
boolean "true" means the invalidation listener was successfully removed.
"false" means either passed listener object is null or listener support is not enable.
See Also:
addChangeListener
- boolean addChangeListener(ChangeListener listener)
addChangeListener - adds a change listener for this DistributedMap.
Parameters:
listener
- the change listener object Returns:
boolean "true" means the change listener was successfully added.
"false" means either the passed listener object is null or listener support is not enable.
See Also:
removeChangeListener
- boolean removeChangeListener(ChangeListener listener)
removeChangeListener - removes a change listener for this DistributedMap.
Parameters:
listener
- the change listener object Returns:
boolean "true" means the change listener was successfully removed.
"false" means either passed listener object is null or listener support is not enable.
See Also:
addAlias
- void addAlias(java.lang.Object key,
- java.lang.Object[] aliasArray)
Adds an alias for the given key in the cache's mapping table. If the alias is already
associated with another key, it will be changed to associate with the new key.
Parameters:
key
- the key assoicated with alias aliasArray
- the alias to use for lookups Throws:
java.lang.IllegalArgumentException
- if the key is not in the cache's mapping table. removeAlias
- void removeAlias(java.lang.Object alias)
Removes an alias from the cache's mapping table.
Parameters:
alias
- the alias to move out of the cache's mapping table size
- int size(boolean includeDiskCache)
Returns the total number of key-value mappings. Returns size of memory map plus disk map if includeDiskCache is
true. Returns size of memory map size if includeDiskCache is false.
Parameters:
includeDiskCache
- true to get the size of the memory and disk maps; false to get the size of memory map. Returns:
the number of key-value mappings in this map.
isEmpty
- boolean isEmpty(boolean includeDiskCache)
Returns true if this map contains no key-value mappings. Checks both memory and disk maps if includeDiskCache
is true. Check only memory cache if includeDiskCache is false.
Parameters:
includeDiskCache
- true to check the memory and disk maps; false to check the memory map. Returns:
true if this map contains no key-value mappings.
containsKey
- boolean containsKey(java.lang.Object key,
- boolean includeDiskCache)
Returns true if this map contains mapping for the specified key. Checks both memory and disk map if includeDiskCache
is true. Check only memory map if includeDiskCache is false.
Parameters:
key
- whose presence in this map is to be tested. includeDiskCache
- true to check the specified key contained in the memory or disk maps; false to check the specified key contained in the memory map. Returns:
true if this map contains a mapping for the specified key.
keySet
- java.util.Set keySet(boolean includeDiskCache)
Returns a set view of the keys contained in this map. Returns all the keys in both memory map and disk map if includeDiskCache is true.
Return only keys in memory map if includeDiskCache is false.
Warning: If this method is used with includeDiskCache set to true, all the keys on disk are read into memory and that might consume a lot of memory depending
on the size of disk map.
Parameters:
includeDiskCache
- true to get keys contained in the memory and disk maps; false to get keys contained in the memory map. Returns:
a set view of the keys contained in this map.