borland Packages  Class Hierarchy  dbswing Package 

LRUCache component

java.lang.Object
   +----com.borland.dbswing.LRUCache

About the LRUCache component

Constructors  Properties  Methods  

Implements Serializable

Note: This is a feature of JBuilder Professional and Enterprise.

LRUCache is used by JdbTable to cache images stored in Variant.INPUTSTREAM fields. Don't deploy this class unless your DataSet contains images and displays them using a dbSwing component.

LRUCache is a resizable,"least-recently-used" (LRU) general-purpose cache. An LRUCache holds a fixed number of items (25 by default). When the cache is full, adding a new item causes the "oldest" item in the cache to be removed and the new item to become the "newest" item. If an item already in the cache is added to a full cache or if an item is fetched from the cache, that item's "age" is updated so that it becomes the "newest" item in the cache.


LRUCache constructors

LRUCache properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

LRUCache methods

Methods implemented in this class

Methods implemented in java.lang.Object


LRUCache constructors

LRUCache()

  public LRUCache()
Constructs an LRUCache component with space for a maximum of 25 cached items.

LRUCache(int)

  public LRUCache(int maxItems)
Constructs an LRUCache component with space for the specified maximum number of cached items.

Parameters:

maxItems
The maximum number of cached items.

LRUCache properties

maxItems

 public int getMaxItems()
 public void setMaxItems(int newMaxItems)
Returns and sets the maximum number of items held in the cache.

LRUCache methods

emptyCache()

  public void emptyCache()
Empties the cache.

get(java.lang.Object)

  public Object get(Object key)
Returns the item in the cache identified by the specified (non-null) key. Returns null if the key cannot be found in the cache.

Parameters:

key
The key by which to retrieve the item.

put(java.lang.Object, java.lang.Object)

  public void put(Object key, Object item)
Puts an item, retrievable by the specified key, into the cache. Keys and items should not be null.

Parameters:

key
The key by which to retrieve the item.
item
The item to put into the cache.