|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.cache.UnOrderedCache
Unordered cache is a hash map backed class. As such, access to individual items is relatively quick. However getting all the items in cache is a very slow process, and the order of the items is not guaranteed.
If the size of the unordered cache is specified, then the cache automatically uses the least recently used (LRU) algorithm to determine which items should be removed from the cache. Unless you need to specifically store arrays of objects then this will be the cache to use for most of your needs. Creation date: (9/7/00 11:47:14 AM)
| Constructor Summary | |
UnOrderedCache()
UnOrderedCache constructor comment. |
|
| Method Summary | |
void |
addItem(CacheEntry newItem)
Adds an item to this cache |
void |
clear()
Clear the cache by creating a new map |
CacheEntry |
getCacheEntry(String itemKey)
Retrieve the cache entry specified by the item key |
Cacheable |
getItem(String itemKey)
Get an item as defined by the key. |
int |
getItemCount()
Get the number of items in the cache |
Vector |
getItems()
Return all the items in a Vector This is a REALLY messy function for unordered caches. |
String |
getName()
Returns the name of this cache |
long |
getUsedCount()
Return the number of times this cache has been accessed |
boolean |
isOrdered()
Retrieve whether the cache instance is an ordered cache [list based] or unordered cache. |
void |
removeItem(Cacheable oldItem)
Removes an item as keyed by the paramter |
void |
setItems(List newItems)
Eventually the new way to set items |
void |
setItems(Vector newItems)
Goes through all the new items and adds them to the list. |
void |
setMaxSize(int newMaxSize)
Sets the maximum size for the cache. |
void |
setName(String newName)
Sets the name of the cache |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public UnOrderedCache()
| Method Detail |
public void addItem(CacheEntry newItem)
addItem in interface CachenewItem - The new item to cachepublic void clear()
clear in interface Cachepublic CacheEntry getCacheEntry(String itemKey)
getCacheEntry in interface CacheitemKey - the key for the cache entry
public Cacheable getItem(String itemKey)
getItem in interface CacheitemKey - The item's key
Cacheable object or null if it doesn't exist in the
cachepublic int getItemCount()
getItemCount in interface Cachepublic Vector getItems()
getItems in interface Cachejava.util.Vector of all the items.public String getName()
getName in interface Cachejava.lang.String the name of the cachepublic long getUsedCount()
getUsedCount in interface Cachepublic boolean isOrdered()
isOrdered in interface Cachepublic void removeItem(Cacheable oldItem)
removeItem in interface CacheoldItem - The item to remove.
public void setItems(List newItems)
throws CacheException
setItems in interface CachenewItems - the new items to add
CacheException - upon error
public void setItems(Vector newItems)
throws CacheException
setItems in interface CachenewItems - A java.util.Vector of new items to add to
the cache list
CacheException - if there's an error adding the cache entry itemspublic void setMaxSize(int newMaxSize)
setMaxSize in interface CachenewMaxSize - The new maximum size to use for the cachepublic void setName(String newName)
setName in interface CachenewName - the new name to set for the cache.
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||