DVOCacher

public interface DVOCacher

The DVOCacher is a component that caches the DVO(s) into partiular format designated in the sub-class. To store DVO that have multiple key, it is recommended to combine the key as a string by a separator “_”. For example, If the messageDVO has the key message_id and message_box, You should use combined key message_id_message_box. Creation Date: 12/2/2007

Author:Twinsen Tsang

Methods

activeSize

int activeSize()

The activs size is defined how many DVO are already stored in the cacher.

Returns:Get the active size of DVO cacher.

efficieny

double efficieny()

This method is used to calculate the getDVO(String) efficieny (eff) of the cacher. It is formulated :

            cacheHit
eff = (--------------------) * 100
       cacheHit + cacheMiss
Returns:the efficiency of the cacher.

getDVO

DVO getDVO(String key)

Get the DVO cache from the particular key.

Parameters:
  • key – The key field of the DVO.
Returns:

Return null if the cache record does not exist.

maxSize

int maxSize()

The maximum size is defined how many DVO are the cacher can store before swapping out happens.

Returns:Get the maximum size of DVO cacher.

putDVO

void putDVO(String key, DVO cacheItem)

Store the DVO cacheItem into the cacher with the specified Key. If the DVO in the key is already exist, it throws CacheException indicating cache duplication.

Parameters:
  • key – The key field of the DVO.
  • cacheItem – The DVO item to be cached.
Throws:

See also: .putOrUpdateDVO(String,DVO);

putOrUpdateDVO

void putOrUpdateDVO(String key, DVO cacheItem)

Store or Update the DVO cacheItem into the cacher with the specified Key.

Parameters:
  • key – The key field of the DVO.
  • cacheItem – The DVO item to be cached.

removeAll

void removeAll()

Remove all the cache record.

removeDVO

void removeDVO(String key)

Remove the cache record with the key field equal to key.

Parameters:
  • key – The DVO’s key field to remove.