com.ibm.commerce.order.calculation
Class Cache
java.lang.Object
com.ibm.commerce.order.calculation.Cache
- Direct Known Subclasses:
- CodeCache, CodeDescriptionCache, CodeMemberGroupRelationshipCache, CodeTaxExemptionCache, IndirectAttachmentCache, JurisdictionGroupCache, LookupResultCache, MethodCache, RangeCache, RuleCache, RuleMemberGroupRelationshipCache, RuleScaleRelationshipCache, ScaleCache, ShippingArrangementCache, ShippingJurisdictionCache, ShippingRuleCache, StoreEntityUsageCache, TaxCategoryIdCache, TaxRuleCache, TaxTypeCache, UsageSequenceCache
- public abstract class Cache
- extends java.lang.Object
An abstract class for implementing LRU cache classes.
Field Summary |
static java.lang.String |
COPYRIGHT
The IBM copyright notice fields. |
static int |
DEFAULT_MAX_SIZE
The default maximum cache size. |
Constructor Summary |
Cache()
Constructor for Cache, with a maximum size of DEFAULT_MAX_SIZE. |
Cache(int anMaxSize)
Constructor for Cache. |
Method Summary |
void |
clear()
Clears the cache. |
java.lang.Object |
get(java.lang.Object aKey)
Returns the value which the key is mapped to. |
protected int |
getSize(java.lang.Object aValue)
Returns the size of a value. |
protected abstract java.lang.Object |
miss(java.lang.Object aKey)
Returns the value a key is mapped to. |
java.lang.Object |
remove(java.lang.Object aKey)
Removes the value which the key is mapped to. |
void |
setMaxSize(int anMaxSize)
Sets the maximum size of the cache. |
void |
setSize(int anMaxSize)
Deprecated. renamed to setMaxSize(int). |
java.lang.String |
toString()
Returns the string representation of the cache for diagnostic purposes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
COPYRIGHT
public static final java.lang.String COPYRIGHT
- The IBM copyright notice fields.
- See Also:
- Constant Field Values
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZE
- The default maximum cache size.
- See Also:
- Constant Field Values
Cache
public Cache()
- Constructor for Cache, with a maximum size of DEFAULT_MAX_SIZE.
Cache
public Cache(int anMaxSize)
- Constructor for Cache.
- Parameters:
- anMaxSize - the maximum size of the cache.
clear
public void clear()
- Clears the cache.
remove
public java.lang.Object remove(java.lang.Object aKey)
throws ECException
- Removes the value which the key is mapped to.
-
- Parameters:
- aKey - the key.
- Returns:
- the removed value.
- Throws:
- ECException
get
public java.lang.Object get(java.lang.Object aKey)
throws ECException
- Returns the value which the key is mapped to.
-
- Parameters:
- aKey - the key.
- Returns:
- the value.
- Throws:
- ECException
getSize
protected int getSize(java.lang.Object aValue)
- Returns the size of a value. This method is called by get(Object) and should be overridden by the implementing class.
-
- Parameters:
- aValue - the value.
- Returns:
- 1 for all values.
miss
protected abstract java.lang.Object miss(java.lang.Object aKey)
throws ECException
- Returns the value a key is mapped to. This method is called by get(Object) when the mapping is not found in the cache and should be overridden by the implementing class.
-
- Parameters:
- aKey - the key.
- Returns:
- the value.
- Throws:
- ECException
setMaxSize
public void setMaxSize(int anMaxSize)
- Sets the maximum size of the cache.
-
- Parameters:
- anMaxSize - the maximum size of the cache.
setSize
public void setSize(int anMaxSize)
- Deprecated. renamed to setMaxSize(int).
- Sets the maximum size of the cache.
-
- Parameters:
- anMaxSize - the maximum size of the cache.
toString
public java.lang.String toString()
- Returns the string representation of the cache for diagnostic purposes.
-
- Returns:
- the string representation of the cache.
Feedback
(C) Copyright IBM Corporation 1996, 2005. All Rights Reserved.