public class LayerCacheImpl extends GenericCacheImpl<ILayer> implements ILayerCache, Serializable
ILayerCache
interface by using
ConcurrentLinkedHashMap
to create a map that supports a maximum
number of cached entries with eviction notification of LRU entries. It also
adds methods for cloning and dumping the cache contents.
The cache actually consists of two maps. The layerMap is a map of
ILayer
objects associated with keys that identify the layer
according to the modules contained in the layer. The layerBuildMap
is a map of CacheEntry
objects associated with keys that
identify the layer as well as build specific identifiers. There is
a one-to-many association of layerMap entries to layerBuildMap
entries. Each CacheEntry
object identifies the filename(s)
of the files that contain the built content for the layer build.
The layerBuildMap can have a size limit. When the limit is reached LRU entries will be evicted by calling the eviction listener specified when the map was created. The eviction listener removes the association between the evicted entry and the ILayer object. When a ILayer object no longer has any CacheEntry objects in the layerBuildMap, it is removed from the layerMap.
Modifier and Type | Class and Description |
---|---|
protected static class |
LayerCacheImpl.SerializationProxy |
cacheMap
Modifier | Constructor and Description |
---|---|
protected |
LayerCacheImpl() |
|
LayerCacheImpl(IAggregator aggregator) |
protected |
LayerCacheImpl(LayerCacheImpl layerCache)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all entries in the cache
|
void |
dump(Writer writer,
Pattern filter)
Output the cache info to the specified Writer
|
ILayer |
getLayer(javax.servlet.http.HttpServletRequest request)
Returns a layer object for the specified request.
|
protected int |
getMaxCapacity(IAggregator aggregator) |
protected com.googlecode.concurrentlinkedhashmap.EvictionListener<String,com.ibm.jaggr.core.impl.layer.CacheEntry> |
newEvictionListener() |
protected com.googlecode.concurrentlinkedhashmap.Weigher<com.ibm.jaggr.core.impl.layer.CacheEntry> |
newWeigher() |
void |
setAggregator(IAggregator aggregator)
Called for newly created (or de-serialized) caches to set the
aggregator instance for this cache.
|
protected Object |
writeReplace() |
contains, get, getKeys, newInstance, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
contains, get, getKeys, size
newInstance
protected LayerCacheImpl()
protected LayerCacheImpl(LayerCacheImpl layerCache)
layerCache
- public LayerCacheImpl(IAggregator aggregator)
public void clear()
IGenericCache
clear
in interface IGenericCache
clear
in interface ILayerCache
clear
in class GenericCacheImpl<ILayer>
public void dump(Writer writer, Pattern filter) throws IOException
IGenericCache
dump
in interface IGenericCache
dump
in interface ILayerCache
dump
in class GenericCacheImpl<ILayer>
writer
- the target Writerfilter
- Optional filter argumentIOException
public ILayer getLayer(javax.servlet.http.HttpServletRequest request)
ILayerCache
getLayer
in interface ILayerCache
request
- the request objectpublic void setAggregator(IAggregator aggregator)
IGenericCache
IAggregator.getConfig()
may return null if called
from within this method.setAggregator
in interface IGenericCache
setAggregator
in interface ILayerCache
setAggregator
in class GenericCacheImpl<ILayer>
aggregator
- The aggregator instance for the cacheprotected com.googlecode.concurrentlinkedhashmap.EvictionListener<String,com.ibm.jaggr.core.impl.layer.CacheEntry> newEvictionListener()
protected com.googlecode.concurrentlinkedhashmap.Weigher<com.ibm.jaggr.core.impl.layer.CacheEntry> newWeigher()
protected int getMaxCapacity(IAggregator aggregator)
protected Object writeReplace() throws ObjectStreamException
ObjectStreamException
Copyright © 2011-2015 IBM. All Rights Reserved.