ehcache

net.sf.ehcache.store
Class MemoryOnlyStore

java.lang.Object
  extended by net.sf.ehcache.store.AbstractStore
      extended by net.sf.ehcache.store.FrontEndCacheTier<NullStore,MemoryStore>
          extended by net.sf.ehcache.store.MemoryOnlyStore
All Implemented Interfaces:
Store

public final class MemoryOnlyStore
extends FrontEndCacheTier<NullStore,MemoryStore>

A memory-only store with support for all caching features.

Author:
Ludovic Orban

Field Summary
 
Fields inherited from class net.sf.ehcache.store.FrontEndCacheTier
authority, cache
 
Fields inherited from interface net.sf.ehcache.store.Store
CLUSTER_COHERENT, NODE_COHERENT
 
Method Summary
static Store create(Ehcache cache, Pool onHeapPool)
          Create an instance of MemoryStore
 Results executeQuery(StoreQuery query)
          Execute the given query on this store
 Element get(Object key)
          Gets an item from the cache.
 Policy getInMemoryEvictionPolicy()
          
 Object getMBean()
          Optional implementation specific MBean exposed by the store.
 Element getQuiet(Object key)
          Gets an Element from the Store, without updating statistics
<T> Attribute<T>
getSearchAttribute(String attributeName)
          Retrieve the given named search attribute
 void setAttributeExtractors(Map<String,AttributeExtractor> extractors)
          Inform this store of the configured attribute extractors.
 void setInMemoryEvictionPolicy(Policy policy)
          Sets the eviction policy strategy.
 
Methods inherited from class net.sf.ehcache.store.FrontEndCacheTier
bufferFull, containsKey, containsKeyInMemory, containsKeyOffHeap, containsKeyOnDisk, copyElementForReadIfNeeded, copyElementForWriteIfNeeded, dispose, expireElements, flush, getAllLocks, getInMemorySize, getInMemorySizeInBytes, getInternalContext, getKeys, getLockFor, getOffHeapSize, getOffHeapSizeInBytes, getOnDiskSize, getOnDiskSizeInBytes, getSize, getStatus, getTerracottaClusteredSize, hasAbortedSizeOf, isCached, isEvictionCandidate, isPinned, notifyEvictionFromCache, put, putIfAbsent, putWithWriter, recalculateSize, remove, removeAll, removeElement, removeWithWriter, replace, replace, setPinned, unpinAll
 
Methods inherited from class net.sf.ehcache.store.AbstractStore
addStoreListener, getAll, getAllQuiet, getEventListenerList, isCacheCoherent, isClusterCoherent, isNodeCoherent, putAll, removeAll, removeStoreListener, setNodeCoherent, waitUntilClusterCoherent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static Store create(Ehcache cache,
                           Pool onHeapPool)
Create an instance of MemoryStore

Parameters:
cache - the cache
onHeapPool - the on heap pool
Returns:
an instance of MemoryStore

get

public Element get(Object key)
Gets an item from the cache.

Specified by:
get in interface Store
Overrides:
get in class FrontEndCacheTier<NullStore,MemoryStore>

getQuiet

public Element getQuiet(Object key)
Gets an Element from the Store, without updating statistics

Specified by:
getQuiet in interface Store
Overrides:
getQuiet in class FrontEndCacheTier<NullStore,MemoryStore>
Returns:
The element

setInMemoryEvictionPolicy

public void setInMemoryEvictionPolicy(Policy policy)
Sets the eviction policy strategy. The Store will use a policy at startup. The store may allow changing the eviction policy strategy dynamically. Otherwise implementations will throw an exception if this method is called.

Specified by:
setInMemoryEvictionPolicy in interface Store
Overrides:
setInMemoryEvictionPolicy in class FrontEndCacheTier<NullStore,MemoryStore>
Parameters:
policy - the new policy

getInMemoryEvictionPolicy

public Policy getInMemoryEvictionPolicy()

Specified by:
getInMemoryEvictionPolicy in interface Store
Overrides:
getInMemoryEvictionPolicy in class FrontEndCacheTier<NullStore,MemoryStore>
Returns:
the current eviction policy. This may not be the configured policy, if it has been dynamically set.
See Also:
Store.setInMemoryEvictionPolicy(Policy)

setAttributeExtractors

public void setAttributeExtractors(Map<String,AttributeExtractor> extractors)
Inform this store of the configured attribute extractors. Stores that will not invoke extractors are free to ignore this call

Specified by:
setAttributeExtractors in interface Store
Overrides:
setAttributeExtractors in class AbstractStore

executeQuery

public Results executeQuery(StoreQuery query)
Execute the given query on this store

Specified by:
executeQuery in interface Store
Overrides:
executeQuery in class AbstractStore
Parameters:
query - query to execute
Returns:
query results

getSearchAttribute

public <T> Attribute<T> getSearchAttribute(String attributeName)
                                throws CacheException
Retrieve the given named search attribute

Specified by:
getSearchAttribute in interface Store
Overrides:
getSearchAttribute in class AbstractStore
Type Parameters:
T - type of the attribute
Parameters:
attributeName - the name of the attribute to retrieve
Returns:
the search attribute or null if non-existent
Throws:
CacheException

getMBean

public Object getMBean()
Optional implementation specific MBean exposed by the store.

Returns:
implementation specific management bean

ehcache

Copyright © 2003-2013 Terracotta, Inc.. All Rights Reserved.