Top Fields Constructors Methods
net.sf.ehcache.store

public abstract Class AbstractStore

extends Object
implements Store
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.store.Store
Known Direct Subclasses
net.sf.ehcache.store.LegacyStoreWrapper, net.sf.ehcache.store.LruMemoryStore, net.sf.ehcache.store.MemoryStore, net.sf.ehcache.store.disk.DiskStore, net.sf.ehcache.transaction.AbstractTransactionStore
Imports
java.util.ArrayList, .Collection, .HashMap, .HashSet, .List, .Map, .Set, java.util.concurrent.ConcurrentHashMap, net.sf.ehcache.CacheException, .Element, net.sf.ehcache.config.InvalidConfigurationException, net.sf.ehcache.search.Attribute, .Results, net.sf.ehcache.search.attribute.AttributeExtractor, .DynamicAttributesExtractor, net.sf.ehcache.search.impl.SearchManager, net.sf.ehcache.terracotta.TerracottaNotRunningException

Author
gkeim

Field Summary

Modifier and TypeField and Description
protected final Map<String, AttributeExtractor>
attributeExtractors

search attribute extractors

private final String
private transient List<StoreListener>
listenerList

listener list

protected final SearchManager
searchManager

search manager

Constructor Summary

AccessConstructor and Description
protected
AbstractStore()

Constructor for stores that do not support search

protected
AbstractStore(SearchManager
the search manager to use
searchManager
,
String cacheName)

Constructor for stores that do support search

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addStoreListener(StoreListener listener)

Implements net.sf.ehcache.store.Store.addStoreListener.

Add a listener to the store.
public Results
executeQuery(StoreQuery
query to execute
query
)

Implements net.sf.ehcache.store.Store.executeQuery.

Execute the given query on this store
public Map<Object, Element>
getAll(Collection<?>
a collection of keys to look for
keys
)

Implements net.sf.ehcache.store.Store.getAll.

Retries the elements associated with a set of keys and update the statistics Keys which are not present in the cache will have null values associated with them in the returned map
public Map<Object, Element>
getAllQuiet(Collection<?>
a collection of keys to look for
keys
)

Implements net.sf.ehcache.store.Store.getAllQuiet.

Retries the elements associated with a set of keys without updating the statistics Keys which are not present in the cache will have null values associated with them in the returned map
protected synchronized List<StoreListener>
getEventListenerList()

onLoad initializer

public <T> Attribute<T>
getSearchAttribute(String
the name of the attribute to retrieve
attributeName
)

Implements net.sf.ehcache.store.Store.getSearchAttribute.

Retrieve the given named search attribute
public Set<Attribute<T>>
public boolean
hasAbortedSizeOf()

Implements net.sf.ehcache.store.Store.hasAbortedSizeOf.

Checks if the cache may contain elements for which the SizeOf engine gave up and only partially calculated the size.
public boolean
isCacheCoherent()

Implements net.sf.ehcache.store.Store.isCacheCoherent.

Indicates whether this store provides a coherent view of all the elements in a cache.
public boolean
isClusterCoherent()

Implements net.sf.ehcache.store.Store.isClusterCoherent.

Returns true if the cache is in coherent mode cluster-wide.
public boolean
isNodeCoherent()

Implements net.sf.ehcache.store.Store.isNodeCoherent.

Returns true if the cache is in coherent mode for the current node.
public void
putAll(Collection<Element>
Collection of elements to be put in the store
elements
)

Implements net.sf.ehcache.store.Store.putAll.

Puts a collection of elements into the store.
public void
recalculateSize(Object
the key
key
)

Implements net.sf.ehcache.store.Store.recalculateSize.

Recalculate size of the element mapped to the key
public void
removeAll(Collection<?> keys)

Implements net.sf.ehcache.store.Store.removeAll.

Removes a collection of elements from the cache.
public synchronized void
removeStoreListener(StoreListener listener)

Implements net.sf.ehcache.store.Store.removeStoreListener.

Remove listener from store.
public void
setAttributeExtractors(Map<String, AttributeExtractor> extractors)

Implements net.sf.ehcache.store.Store.setAttributeExtractors.

Inform this store of the configured attribute extractors.
public void
setNodeCoherent(boolean
true transitions to coherent mode, false to incoherent mode
coherent
)

Implements net.sf.ehcache.store.Store.setNodeCoherent.

Sets the cache in coherent or incoherent mode for the current node depending on the parameter.
public void
waitUntilClusterCoherent()

Implements net.sf.ehcache.store.Store.waitUntilClusterCoherent.

This method waits until the cache is in coherent mode in all the connected nodes.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeExtractorsback to summary
protected final Map<String, AttributeExtractor> attributeExtractors

search attribute extractors

cacheNameback to summary
private final String cacheName
listenerListback to summary
private transient List<StoreListener> listenerList

listener list

searchManagerback to summary
protected final SearchManager searchManager

search manager

Constructor Detail

AbstractStoreback to summary
protected AbstractStore()

Constructor for stores that do not support search

AbstractStoreback to summary
protected AbstractStore(SearchManager searchManager, String cacheName)

Constructor for stores that do support search

Parameters
searchManager:SearchManager

the search manager to use

Method Detail

addStoreListenerback to summary
public synchronized void addStoreListener(StoreListener listener)

Implements net.sf.ehcache.store.Store.addStoreListener.

Doc from net.sf.ehcache.store.Store.addStoreListener.

Add a listener to the store.

See Also
net.sf.ehcache.store.Store#addStoreListener(net.sf.ehcache.store.StoreListener)
executeQueryback to summary
public Results executeQuery(StoreQuery query)

Implements net.sf.ehcache.store.Store.executeQuery.

Doc from net.sf.ehcache.store.Store.executeQuery.

Execute the given query on this store

Parameters
query:StoreQuery

query to execute

Returns:Results

query results

getAllback to summary
public Map<Object, Element> getAll(Collection<?> keys)

Implements net.sf.ehcache.store.Store.getAll.

Doc from net.sf.ehcache.store.Store.getAll.

Retries the elements associated with a set of keys and update the statistics Keys which are not present in the cache will have null values associated with them in the returned map

Parameters
keys:Collection<?>

a collection of keys to look for

Returns:Map<Object, Element>

a map of keys and their corresponding values

getAllQuietback to summary
public Map<Object, Element> getAllQuiet(Collection<?> keys)

Implements net.sf.ehcache.store.Store.getAllQuiet.

Doc from net.sf.ehcache.store.Store.getAllQuiet.

Retries the elements associated with a set of keys without updating the statistics Keys which are not present in the cache will have null values associated with them in the returned map

Parameters
keys:Collection<?>

a collection of keys to look for

Returns:Map<Object, Element>

a map of keys and their corresponding values

getEventListenerListback to summary
protected synchronized List<StoreListener> getEventListenerList()

onLoad initializer

getSearchAttributeback to summary
public <T> Attribute<T> getSearchAttribute(String attributeName) throws CacheException

Implements net.sf.ehcache.store.Store.getSearchAttribute.

Doc from net.sf.ehcache.store.Store.getSearchAttribute.

Retrieve the given named search attribute

Parameters
<T>
type of the attribute
attributeName:String

the name of the attribute to retrieve

Returns:Attribute<T>

the search attribute or null if non-existent

getSearchAttributesback to summary
public Set<Attribute<T>> getSearchAttributes()

Implements net.sf.ehcache.store.Store.getSearchAttributes.

Returns:Set<Attribute<T>>

Doc from net.sf.ehcache.store.Store.getSearchAttributes.

all search attributes known to this store at the time of invoking the method

Annotations
@Override
hasAbortedSizeOfback to summary
public boolean hasAbortedSizeOf()

Implements net.sf.ehcache.store.Store.hasAbortedSizeOf.

Doc from net.sf.ehcache.store.Store.hasAbortedSizeOf.

Checks if the cache may contain elements for which the SizeOf engine gave up and only partially calculated the size.

Returns:boolean

true if at least one partially sized element may be in the cache

isCacheCoherentback to summary
public boolean isCacheCoherent()

Implements net.sf.ehcache.store.Store.isCacheCoherent.

Doc from net.sf.ehcache.store.Store.isCacheCoherent.

Indicates whether this store provides a coherent view of all the elements in a cache. Note that this is same as calling isClusterCoherent() (introduced since 2.0) Use isNodeCoherent() to find out if the cache is coherent in the current node in the cluster

Returns:boolean

true if the store is coherent; or false if the store potentially splits the cache storage with another store or isn't internally coherent

See Also
net.sf.ehcache.store.Store#isCacheCoherent()
isClusterCoherentback to summary
public boolean isClusterCoherent()

Implements net.sf.ehcache.store.Store.isClusterCoherent.

Doc from net.sf.ehcache.store.Store.isClusterCoherent.

Returns true if the cache is in coherent mode cluster-wide. Returns false otherwise.

It applies to coherent clustering mechanisms only e.g. Terracotta

Returns:boolean

true if the cache is in coherent mode cluster-wide, false otherwise

See Also
net.sf.ehcache.store.Store#isClusterCoherent()
isNodeCoherentback to summary
public boolean isNodeCoherent()

Implements net.sf.ehcache.store.Store.isNodeCoherent.

Doc from net.sf.ehcache.store.Store.isNodeCoherent.

Returns true if the cache is in coherent mode for the current node. Returns false otherwise.

It applies to coherent clustering mechanisms only e.g. Terracotta

Returns:boolean

true if the cache is in coherent mode cluster-wide, false otherwise

See Also
net.sf.ehcache.store.Store#isNodeCoherent()
putAllback to summary
public void putAll(Collection<Element> elements) throws CacheException

Implements net.sf.ehcache.store.Store.putAll.

Doc from net.sf.ehcache.store.Store.putAll.

Puts a collection of elements into the store.

Parameters
elements:Collection<Element>

Collection of elements to be put in the store

recalculateSizeback to summary
public void recalculateSize(Object key)

Implements net.sf.ehcache.store.Store.recalculateSize.

Doc from net.sf.ehcache.store.Store.recalculateSize.

Recalculate size of the element mapped to the key

Parameters
key:Object

the key

removeAllback to summary
public void removeAll(Collection<?> keys)

Implements net.sf.ehcache.store.Store.removeAll.

Doc from net.sf.ehcache.store.Store.removeAll.

Removes a collection of elements from the cache.

removeStoreListenerback to summary
public synchronized void removeStoreListener(StoreListener listener)

Implements net.sf.ehcache.store.Store.removeStoreListener.

Doc from net.sf.ehcache.store.Store.removeStoreListener.

Remove listener from store.

See Also
net.sf.ehcache.store.Store#removeStoreListener(net.sf.ehcache.store.StoreListener)
setAttributeExtractorsback to summary
public void setAttributeExtractors(Map<String, AttributeExtractor> extractors)

Implements net.sf.ehcache.store.Store.setAttributeExtractors.

Doc from net.sf.ehcache.store.Store.setAttributeExtractors.

Inform this store of the configured attribute extractors. Stores that will not invoke extractors are free to ignore this call

setNodeCoherentback to summary
public void setNodeCoherent(boolean coherent) throws UnsupportedOperationException

Implements net.sf.ehcache.store.Store.setNodeCoherent.

Doc from net.sf.ehcache.store.Store.setNodeCoherent.

Sets the cache in coherent or incoherent mode for the current node depending on the parameter. Calling setNodeCoherent(true) when the cache is already in coherent mode or calling setNodeCoherent(false) when already in incoherent mode will be a no-op.

It applies to coherent clustering mechanisms only e.g. Terracotta

Parameters
coherent:boolean

true transitions to coherent mode, false to incoherent mode

Exceptions
UnsupportedOperationException:
if this store does not support cache coherence, like RMI replication
See Also
net.sf.ehcache.store.Store#setNodeCoherent(boolean)
waitUntilClusterCoherentback to summary
public void waitUntilClusterCoherent() throws UnsupportedOperationException, TerracottaNotRunningException, InterruptedException

Implements net.sf.ehcache.store.Store.waitUntilClusterCoherent.

Doc from net.sf.ehcache.store.Store.waitUntilClusterCoherent.

This method waits until the cache is in coherent mode in all the connected nodes. If the cache is already in coherent mode it returns immediately

It applies to coherent clustering mechanisms only e.g. Terracotta

Exceptions
UnsupportedOperationException:
if this store does not support cache coherence, like RMI replication
See Also
net.sf.ehcache.store.Store#waitUntilClusterCoherent()