org.objectweb.speedo.usercache.api
Interface UserCacheView

All Known Implementing Classes:
UserCacheViewImpl

public interface UserCacheView

Defines an user view of the cache of persistent objects

Author:
S.Chassande-Barrioz

Method Summary
 java.lang.Object bind(java.lang.Object key, java.lang.Object obj)
          Register a persistent instance into the user view.
 void clean()
          Try to auto clean the user cache view.
 java.lang.Object lookup(java.lang.Class clazz, java.lang.Object key)
          Look for a persistent instance with an user identifier and a class
 java.lang.Object rebind(java.lang.Object oldkey, java.lang.Object newkey, java.lang.Object obj)
          Register an entry with an new user key.
 java.lang.Object unbind(java.lang.Class clazz, java.lang.Object key)
          Forces the eviction of an entry
 

Method Detail

lookup

public java.lang.Object lookup(java.lang.Class clazz,
                               java.lang.Object key)
Look for a persistent instance with an user identifier and a class

Parameters:
clazz - is the class of the searched persistent instance
key - is the user key of the searched persistent instance
Returns:

bind

public java.lang.Object bind(java.lang.Object key,
                             java.lang.Object obj)
Register a persistent instance into the user view. The persistent instance is bound with the couple (obj.getClass(), key). It means that entry are bound per class and par user key.

Parameters:
key - is the user key of the persistent instance
obj - is the persistent instance. It cannot be null.
Returns:
the previous associated persistent instance associated to the specified user key. The null value is returned if no previous instance was registered.

rebind

public java.lang.Object rebind(java.lang.Object oldkey,
                               java.lang.Object newkey,
                               java.lang.Object obj)
Register an entry with an new user key. The old registration is removed.

Parameters:
oldkey - is the old user key of the persistent instance
newkey - is the new user key of the persistent instance
obj - is the persistent instance. It cannot be null.
Returns:
the previous associated persistent instance associated to the new user key. The null value is returned if no previous instance was registered.

unbind

public java.lang.Object unbind(java.lang.Class clazz,
                               java.lang.Object key)
Forces the eviction of an entry

Parameters:
clazz - is the class of the persistent instance
key - is the user key of the persistent instance
Returns:

clean

public void clean()
Try to auto clean the user cache view.