| com.jcorporate.expresso.core.cache.CacheSystem
All known Subclasses: com.jcorporate.expresso.core.cache.DefaultCacheManager,
CacheSystem | public interface CacheSystem (Code) | | This is an interface for an underlying cache system. It allows clients
of the itnerface to add items, retrieve items, and clear caches.
The CacheSystem is not data context aware. Classes that implement this
interface are expected to be one instance per context. The Component System
provides differentiation between caches.
author: Michael Rimov since: Expresso 5.1 |
Method Summary | |
void | addItem(String cacheName, Cacheable newItem) | void | addItem(String cacheName, Cacheable newItem, long expiry) | void | addListener(String listener, String listenTo) Specify a relationship between caches. | void | adjustForMemory() Instructs the cache system to adjust it's usage profile based upon
current memory information that the expresso system is telling us. | void | clear(String cacheName) Clear's the named cache. | void | clear() | void | clearNoNotify() | void | clearNoNotify(String cacheName) Clear the named cache, but don't send the remote system notifications. | Cache | createCache(String cacheName, boolean ordered) Creates a cache as specified by the parameters listed. | Cache | createCache(String cacheName, boolean ordered, int maxSize) Creates a cache defined by whether the cache is to be ordered, it's name
and it's maximum size. | void | displayStatus() Displays the cache status. | boolean | existsCache(String cacheName) Checks to see if the cache already exists. | java.util.Set | getAllCacheNames() | Cache | getCache(String cacheName) Retrieve a given cache by name.
Parameters: cacheName - the name of the cache to retrieve. | Cacheable | getItem(String cacheName, String valueKey) | int | getItemCount(String cacheName) Return a count of the number of items in a cache. | java.util.List | getItems(String cacheName) Return all of the items in a cache. | void | put(String cacheName, Cacheable newItem) Adds a Cacheable item into the cache without clearing
related caches. | void | put(String cacheName, Cacheable newItem, long expiry) Adds a Cacheable item into the cache without clearing
related caches. | void | removeItem(String cacheName, Cacheable itemToRemove) | void | removeItemNoNotify(String cacheName, Cacheable itemToRemove) | void | setItems(String cacheName, java.util.List itemList) Sets a cache to have the particular items specified in itemList. | void | setItems(String cacheName, java.util.List itemList, long expiration) Sets a cache to have the particular items specified in itemList. |
addItem | void addItem(String cacheName, Cacheable newItem) throws CacheException(Code) | | Adds a Cacheable item into the cache
Parameters: cacheName - The name of the cache. Parameters: newItem - The new item to add to the cache throws: CacheException - upon error inserting into the system |
addItem | void addItem(String cacheName, Cacheable newItem, long expiry) throws CacheException(Code) | | Adds an item to the cache named by parameter cacheName
Parameters: cacheName - The name of the cache to store the object in Parameters: newItem - The new item to add to the cache Parameters: expiry - The time in miliseconds that this cache item will expire throws: CacheException - if there's an error inserting the item into thecache |
addListener | void addListener(String listener, String listenTo)(Code) | | Specify a relationship between caches. Whenever an add, clear or remove
event is sent to the specified cache, the listener is cleared as well.
Adding a listener implies the relationship between the caches for the
current
db context.
Parameters: listener - The classname of the listener Parameters: listenTo - The name of the cache to listen to. |
adjustForMemory | void adjustForMemory()(Code) | | Instructs the cache system to adjust it's usage profile based upon
current memory information that the expresso system is telling us.
|
clear | void clear(String cacheName) throws CacheException(Code) | | Clear's the named cache.
Parameters: cacheName - The name of the cache to clear throws: CacheException - if there's an error clearing the cache. |
clear | void clear() throws CacheException(Code) | | Removes all cache items for a particular data context
throws: CacheException - CacheException if there's an error clearing thecache |
clearNoNotify | void clearNoNotify()(Code) | | Clears all caches in this db context but doesn't notify any listeners
|
clearNoNotify | void clearNoNotify(String cacheName)(Code) | | Clear the named cache, but don't send the remote system notifications.
This method actually removes the cache from the list of available
caches
Parameters: cacheName - The name of the cache |
createCache | Cache createCache(String cacheName, boolean ordered) throws CacheException(Code) | | Creates a cache as specified by the parameters listed. Creation date:
(9/7/00 2:18:09 PM)
Parameters: cacheName - java.lang.String the name of the cache Parameters: ordered - boolean true if you want an ordered cache such as forValidValues the newly instantiated Cache |
createCache | Cache createCache(String cacheName, boolean ordered, int maxSize) throws CacheException(Code) | | Creates a cache defined by whether the cache is to be ordered, it's name
and it's maximum size. Creation date: (9/7/00 2:18:09 PM)
Parameters: cacheName - java.lang.String The name of the cache Parameters: ordered - boolean True if you wish for an ordered cache. Parameters: maxSize - The maximum size of the cache the newly instantiated cache |
displayStatus | void displayStatus()(Code) | | Displays the cache status. Currently this is only really used for
debugging purposes.
Creation date: (9/7/00 2:44:05 PM)
|
existsCache | boolean existsCache(String cacheName)(Code) | | Checks to see if the cache already exists. One big note about this is
that unless you already have a ReadLock, the cache may or may not exist
once you go to put your data in the cache. Buyer beware.
Parameters: cacheName - The name of the cache true if the named cache already exists in this data context |
getAllCacheNames | java.util.Set getAllCacheNames()(Code) | | Return an iterator over a list of Strings that contain all the names of
the caches stored in the system [For dbContext default]
java.util.Iterator |
getItem | Cacheable getItem(String cacheName, String valueKey)(Code) | | Get a particular item in the cache
Parameters: cacheName - The name of the cache Parameters: valueKey - The particular item within the cache to get a Cacheable object or null if it doesn't exist in the cache |
getItemCount | int getItemCount(String cacheName)(Code) | | Return a count of the number of items in a cache. Return 0 if there is
no such item
Parameters: cacheName - The name of the cache an item count or zero if the cache doesn't exist or is empty; |
getItems | java.util.List getItems(String cacheName)(Code) | | Return all of the items in a cache. If the cache was created as an
ordered cache, the items will be in the order they were added. If not,
they will be in no particular order. If there is no such cache or no
items, null will be returned.
Parameters: cacheName - The name of the cache to retrieve java.util.List of Cacheable items |
put | void put(String cacheName, Cacheable newItem) throws CacheException(Code) | | Adds a Cacheable item into the cache without clearing
related caches. This is to differentiate between 'changed' items that
are added to the cache via addItem that would require related
caches to be cleared to maintain data integrity. An example of when this
is used is when DBObject.retrieve() is first called, there
is no "referential integrity" issues because the object is
fresh and unmodified.
Parameters: cacheName - the name of the cache to add to Parameters: newItem - the item to add throws: CacheException - upon error putting the item into the cache |
put | void put(String cacheName, Cacheable newItem, long expiry) throws CacheException(Code) | | Adds a Cacheable item into the cache without clearing
related caches. This is to differentiate between 'changed' items that
are added to the cache via addItem that would require related
caches to be cleared to maintain data integrity. An example of when this
is used is when DBObject.retrieve() is first called, there
is no "referential integrity" issues because the object is
fresh and unmodified.
Parameters: cacheName - the name of the cache to add to Parameters: newItem - the item to add Parameters: expiry - The time in miliseconds that this cache item will expire throws: CacheException - upon error putting the item into the cache |
removeItem | void removeItem(String cacheName, Cacheable itemToRemove) throws CacheException(Code) | | Removes an item from the cache
Parameters: cacheName - The name of the cache Parameters: itemToRemove - the key of the item to remove |
removeItemNoNotify | void removeItemNoNotify(String cacheName, Cacheable itemToRemove) throws CacheException(Code) | | Removes an item out of the cache without notifying the cache listeners
Parameters: cacheName - The cache name Parameters: itemToRemove - the key in the cache that has been modified throws: CacheException - Upon error removing the item from the cache |
setItems | void setItems(String cacheName, java.util.List itemList) throws CacheException(Code) | | Sets a cache to have the particular items specified in itemList.
Parameters: cacheName - The name of the cache Parameters: itemList - The items to set into the cache throws: CacheException - if there's an error setting the items. |
setItems | void setItems(String cacheName, java.util.List itemList, long expiration) throws CacheException(Code) | | Sets a cache to have the particular items specified in itemList.
Parameters: cacheName - The name of the cache Parameters: itemList - The items to set into the cache Parameters: expiration - the expiration time in milliseconds for the items. throws: CacheException - if there's an error setting the items. |
|
|