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 class MemoryOnlyStore
extends FrontEndCacheTier<NullStore,MemoryStore>

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

Author:
Ludovic Orban

Nested Class Summary
protected static class MemoryOnlyStore.BruteForceSearchManager
          Brute force search implementation
 
Field Summary
 
Fields inherited from class net.sf.ehcache.store.FrontEndCacheTier
authority, cache
 
Fields inherited from class net.sf.ehcache.store.AbstractStore
attributeExtractors
 
Fields inherited from interface net.sf.ehcache.store.Store
CLUSTER_COHERENT, NODE_COHERENT
 
Constructor Summary
protected MemoryOnlyStore(CacheConfiguration cacheConfiguration, MemoryStore authority, SearchManager searchManager)
          Create a MemoryOnlyStore
 
Method Summary
static Store create(Ehcache cache, Pool onHeapPool)
          Create an instance of MemoryOnlyStore
 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
 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, executeQuery, getAll, getAllQuiet, getEventListenerList, getSearchAttribute, isCacheCoherent, isClusterCoherent, isNodeCoherent, putAll, removeAll, removeStoreListener, setAttributeExtractors, setNodeCoherent, waitUntilClusterCoherent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryOnlyStore

protected MemoryOnlyStore(CacheConfiguration cacheConfiguration,
                          MemoryStore authority,
                          SearchManager searchManager)
Create a MemoryOnlyStore

Parameters:
cacheConfiguration - the cache configuration
authority - the memory store
Method Detail

create

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

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

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)

getMBean

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

Returns:
implementation specific management bean

ehcache

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