org.aris.cache.idcache
Interface CacheCallBackI


public interface CacheCallBackI

Interface for Cache callback.

Author:
Konstantine Kougios

Method Summary
 java.lang.Object findMissingKeyValue(java.lang.Object key)
          This shall find and return the value of a key that was not contained into the IdCache.
 java.lang.Object insertKey(java.lang.Object key, java.lang.Object value)
          This is called when a put() is invoked in the cache, and the key didn't already exist in the cache.
 java.lang.Object removeKey(java.lang.Object key)
          Removes a key and returns it's value (not necessary if you don't use the value later) This is called by the IdCache.remove() and the return value is returned by that.
 boolean updateKey(java.lang.Object key, java.lang.Object value)
          This is called when an update() is invoked in the cache.
 

Method Detail

findMissingKeyValue

java.lang.Object findMissingKeyValue(java.lang.Object key)
                                     throws java.lang.Exception
This shall find and return the value of a key that was not contained into the IdCache.

Parameters:
key - The key that is not contained in the idCache
Returns:
The value associated with this key, or null if the key is not found. If null, the key/value is not cached
Throws:
java.lang.Exception

removeKey

java.lang.Object removeKey(java.lang.Object key)
                           throws java.lang.Exception
Removes a key and returns it's value (not necessary if you don't use the value later) This is called by the IdCache.remove() and the return value is returned by that.

Parameters:
key - The key to remove
Returns:
The value for this key (or null if you don't use the value returned by IdCache.remove())
Throws:
java.lang.Exception

insertKey

java.lang.Object insertKey(java.lang.Object key,
                           java.lang.Object value)
                           throws java.lang.Exception
This is called when a put() is invoked in the cache, and the key didn't already exist in the cache. This also returns the key. This can be the same as the key parameter, or you can use special processing to return a new unique key. As an example, consider calling put(-1,value) to insert new items in a database AND in the cache. This will be called with key=-1, and it shall return the autoincrease value of a database insert sql.

Parameters:
key - The key as passed to the cache.put()
value - The value as passed to the cache.put()
Returns:
A unique key which can be the same as the key parameter.
Throws:
java.lang.Exception

updateKey

boolean updateKey(java.lang.Object key,
                  java.lang.Object value)
                  throws java.lang.Exception
This is called when an update() is invoked in the cache.

Parameters:
key - The key as passed to the cache.put()
value - The value as passed to the cache.put()
Returns:
true for success
Throws:
java.lang.Exception