|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xmlecho.palomar.cache.AbstractCache
org.xmlecho.palomar.cache.SmartCache
Class holds the objects for a specific type.
SmartCache - Smart enough to identify how to store the object( either memory or disk) (TBD: Can spawn a thread(may beCacheProxywhich) wakes up periodically and cleans the cache.
Field Summary protected Policy[]cachePolicies
The policies that can be assigned to a cache.
Fields inherited from class org.xmlecho.palomar.cache.AbstractCache _type, lastRefreshTime, myProperties, refreshFrequency
Constructor Summary SmartCache()
Default constructorSmartCache(java.lang.String tag)
Constructor with a tag identifier.
Method Summary voidclear()
removes all objects from the cachevoidclearCache()
Deprecated.java.lang.Objectget(java.lang.String keyParam)
Method for getting an object from cache.intgetCapacity()
java.lang.StringgetDefaultCacheStorageType()
HoldergetFirst()
get first element in linked listprotected HoldergetHolder(java.lang.String keyParam)
ReturnsHolderobject given a keyHoldergetLast()
get last element in linked listjava.util.PropertiesgetProperties()
Return the characteristics of a specific implementation of IrisCachejava.lang.RunnablegetRunnable()
java.util.MapgetSpecificCache()
voidinvalidate(java.lang.String objectKey)
receive notification of update eventvoidprintCache()
Convinience method for testing.voidput(java.lang.String keyParam, java.lang.Object specificObject)
Method for updating the cache with an object.voidput(java.lang.String keyParam, Policy[] policies, java.lang.Object specificObject)
Method for updating the cache with an object.java.lang.ObjectputMutable(java.lang.String objectKey, java.lang.Object mutableObject)
Cache an object we're going to write some output tojava.lang.ObjectputMutable(java.lang.String irisKey, Policy[] policies, java.lang.Object specificObject)
voidrefresh()
SmartCachespecific implementation of refreshing its cache.voidremove(java.lang.String objectKey)
Remove an object from the cache.voidsetDefaultCacheStorageType(java.lang.String storageType)
voidsetDefaultPolicies(Policy[] cachePolicies)
Setting the default policies for the entire objects in this cache.voidsetFirst(Holder first)
keep track of first element in linked listvoidsetLast(Holder last)
keep track of last element in linked listvoidsetProperties(java.lang.String type, java.util.Properties initialProperties)
Method sets the characteristics of this particular instance.java.lang.StringtoString()
booleanwillWantRefresh()
from Refreshable
Methods inherited from class org.xmlecho.palomar.cache.AbstractCache getCacheDir, getCronExpr, getJobGroupName, getJobName, getKeys, getMaxCacheSize, getNextRefreshTime, getObjects, getRefreshFreq, getRefreshInterval, getType, isEmpty, isTimeToRefresh, runJob, setMaxCacheSize, setRefreshFreq, setRefreshTime, setType, shouldNotify, trimProperties
Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Field Detail cachePolicies
protected Policy[] cachePolicies
- The policies that can be assigned to a cache.
Constructor Detail SmartCache
public SmartCache()
- Default constructor
SmartCache
public SmartCache(java.lang.String tag)
- Constructor with a tag identifier.
- Parameters:
tag- the identifier specifying the type of this instance
Method Detail setProperties
public void setProperties(java.lang.String type, java.util.Properties initialProperties)
- Method sets the characteristics of this particular instance. Method should be called after instantiating an object of this class.
- Parameters:
type- the specific typeinitialProperties- the characteristics of the specific type
getProperties
public java.util.Properties getProperties()
- Description copied from interface:
Cache- Return the characteristics of a specific implementation of IrisCache
- Specified by:
getPropertiesin interfaceCache- Overrides:
getPropertiesin classAbstractCache
get
public java.lang.Object get(java.lang.String keyParam)
- Method for getting an object from cache.
- Parameters:
keyParam- the string representation of the key- Returns:
- the cached Object, or
nullif not found
getHolder
protected Holder getHolder(java.lang.String keyParam)
- Returns
Holderobject given a key
- Parameters:
keyParam- string representation of key- Returns:
- the object's holder
putMutable
public java.lang.Object putMutable(java.lang.String objectKey, java.lang.Object mutableObject) throws java.lang.Exception
- Cache an object we're going to write some output to
- Throws:
java.lang.Exception
put
public void put(java.lang.String keyParam, java.lang.Object specificObject) throws java.lang.Exception
- Method for updating the cache with an object. Gets the default policies to be attached with that particular object.
- Parameters:
keyParam- the key identifier of an object.specificObject- the object to be cached.- Throws:
java.lang.Exception
put
public void put(java.lang.String keyParam, Policy[] policies, java.lang.Object specificObject) throws java.lang.Exception
- Method for updating the cache with an object. Creates
ObjectHolderwith the input parameters.
- Parameters:
keyParam- the key identifier of an object.policies- thePolicyobjects to be attached to an object that has to be cachedspecificObject- the object to be cached.- Throws:
java.lang.Exception
putMutable
public java.lang.Object putMutable(java.lang.String irisKey, Policy[] policies, java.lang.Object specificObject) throws java.lang.Exception
- Throws:
java.lang.Exception
setDefaultCacheStorageType
public void setDefaultCacheStorageType(java.lang.String storageType)
getDefaultCacheStorageType
public java.lang.String getDefaultCacheStorageType()
getCapacity
public int getCapacity()
- Returns:
- the max number of objects the cache will store
getSpecificCache
public java.util.Map getSpecificCache()
setDefaultPolicies
public void setDefaultPolicies(Policy[] cachePolicies)
- Setting the default policies for the entire objects in this cache.
setFirst
public void setFirst(Holder first)
- keep track of first element in linked list
setLast
public void setLast(Holder last)
- keep track of last element in linked list
getFirst
public Holder getFirst()
- get first element in linked list
getLast
public Holder getLast()
- get last element in linked list
willWantRefresh
public boolean willWantRefresh()
- from Refreshable
refresh
public void refresh() throws java.lang.Exception
SmartCachespecific implementation of refreshing its cache.
- Throws:
java.lang.Exception
getRunnable
public java.lang.Runnable getRunnable()
invalidate
public void invalidate(java.lang.String objectKey)
- receive notification of update event
remove
public void remove(java.lang.String objectKey) throws java.lang.Exception
- Remove an object from the cache. Does nothing if the object isn't found
- Parameters:
objectKey- the identifier used when storing the object- Throws:
java.lang.Exception
clear
public void clear()
- removes all objects from the cache
clearCache
public void clearCache()
- Deprecated.
- Method for clearing a particular type of cache.
printCache
public void printCache()
- Convinience method for testing.
toString
public java.lang.String toString()
Overview Package Class Tree Deprecated Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD