com.macvu.tiles.cache
Class LRUCacheService

java.lang.Object
  extended by com.macvu.tiles.cache.LRUCacheService
All Implemented Interfaces:
CacheService

public class LRUCacheService
extends java.lang.Object
implements CacheService

User: MVu


Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
LRUCacheService()
           
LRUCacheService(int maxCacheSize)
           
 
Method Summary
 int getMaxCacheSize()
           
protected  void initiateCacheMap()
           
 void invalidateCache()
           
 java.io.Serializable retrieve(java.io.Serializable key)
          get result from cache map
 void setMaxCacheSize(int maxCacheSize)
          Set the maximum cache size.
 boolean store(java.io.Serializable key, java.io.Serializable result)
          add result to cache map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.apache.commons.logging.Log logger
Constructor Detail

LRUCacheService

public LRUCacheService()

LRUCacheService

public LRUCacheService(int maxCacheSize)
Method Detail

initiateCacheMap

protected void initiateCacheMap()

invalidateCache

public void invalidateCache()

getMaxCacheSize

public int getMaxCacheSize()

setMaxCacheSize

public void setMaxCacheSize(int maxCacheSize)
Set the maximum cache size. If max size is reach, the least recent used item is remove before another item can be placed on the cache. NOTE: cache is clear when the size is change.

Parameters:
maxCacheSize - size of the cache.

store

public boolean store(java.io.Serializable key,
                     java.io.Serializable result)
add result to cache map

Specified by:
store in interface CacheService
Parameters:
key -
result -

retrieve

public java.io.Serializable retrieve(java.io.Serializable key)
get result from cache map

Specified by:
retrieve in interface CacheService
Parameters:
key -
Returns:


Copyright © 2005 MacVu group. All Rights Reserved.