Dashboard Builder Commons 6.0.0.Beta1

org.jboss.dashboard.database.cache.custom
Class HybridCache

java.lang.Object
  extended by org.jboss.dashboard.database.cache.custom.HybridCache
All Implemented Interfaces:
LRUCacheListener, ObjectCache, StatisticsObjectCache

public class HybridCache
extends Object
implements StatisticsObjectCache, LRUCacheListener

A hybrid cache solution that uses a (presumably small) LRU cache backed by a larger AutoCache. This implementation aims to be a good trade-off between cache hit frequency and agressive memory usage.


Constructor Summary
HybridCache(boolean monitorizeCaches, int size)
           
 
Method Summary
 Object clear(Serializable key)
          Clears an object from the cache by key.
 void clearAll()
          Clears the entire cache.
 Object get(Serializable key)
          Gets an object from the cache by key, or returns null if that object is not cached.
 CacheStatistics getCacheStatistics()
          Get the cache statistics
 String getType()
          Gets the common name of the type of objects to cache.
 void objectRemoved(Serializable key, Object value)
          Called when an object is automatically removed from the LRU cache.
 void put(Serializable key, Object object)
          Adds an object to the cache.
 void setType(String type)
          Sets the common name of the type of objects to cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HybridCache

public HybridCache(boolean monitorizeCaches,
                   int size)
Method Detail

getType

public String getType()
Description copied from interface: ObjectCache
Gets the common name of the type of objects to cache.

Specified by:
getType in interface ObjectCache

setType

public void setType(String type)
Description copied from interface: ObjectCache
Sets the common name of the type of objects to cache.

Specified by:
setType in interface ObjectCache

objectRemoved

public void objectRemoved(Serializable key,
                          Object value)
Called when an object is automatically removed from the LRU cache.

Specified by:
objectRemoved in interface LRUCacheListener

put

public void put(Serializable key,
                Object object)
Description copied from interface: ObjectCache
Adds an object to the cache.

Specified by:
put in interface ObjectCache

get

public Object get(Serializable key)
Description copied from interface: ObjectCache
Gets an object from the cache by key, or returns null if that object is not cached.

Specified by:
get in interface ObjectCache

clear

public Object clear(Serializable key)
Description copied from interface: ObjectCache
Clears an object from the cache by key.

Specified by:
clear in interface ObjectCache

clearAll

public void clearAll()
Description copied from interface: ObjectCache
Clears the entire cache.

Specified by:
clearAll in interface ObjectCache

getCacheStatistics

public CacheStatistics getCacheStatistics()
Description copied from interface: StatisticsObjectCache
Get the cache statistics

Specified by:
getCacheStatistics in interface StatisticsObjectCache
Returns:
the cache statistics

Dashboard Builder Commons 6.0.0.Beta1

Copyright © 2012-2013 JBoss by Red Hat. All Rights Reserved.