org.objectweb.speedo.usercache.api
Interface UserCache

All Known Implementing Classes:
CompositeUserCache, UserCacheImpl

public interface UserCache

Defines an user cache of persistent objects. The user cache maintains bindings between an object identifier and the user key. This cache can be implemented such as a coherent double map (oid=>key and key=>oid). The user cache entry can be removed (unbound) from the user key or from the object identifier. Indeed when an object is removed from the real cache, the persistent object is no more availlable, its user key too.

Author:
S.Chassande-Barrioz

Method Summary
 java.lang.Object bind(java.lang.Object key, java.lang.Object oid)
          Adds an entry into user cache.
 int getId()
           
 java.lang.String[] getIndexFieldNames()
           
 java.lang.String getName()
           
 boolean isActive()
           
 java.lang.Object lookup(java.lang.Object key)
          Look for an identifier of persistent instance from an user key
 java.lang.Object unbindFromKey(java.lang.Object key)
          Forces the eviction of an entry from an user key
 java.lang.Object unbindFromOID(java.lang.Object oid)
          Forces the eviction of an entry from an object identifier
 

Method Detail

lookup

public java.lang.Object lookup(java.lang.Object key)
Look for an identifier of persistent instance from an user key

Parameters:
key - is the user key of the searched persistent instance (not null)
Returns:
the identifier of the persistent instance corresponding to the user key. If not found, a null value is returned.

bind

public java.lang.Object bind(java.lang.Object key,
                             java.lang.Object oid)
Adds an entry into user cache. If an entry already exists with the same identifier or the same key, it has been replaced.

Parameters:
key - is the user key the user of the persistent instance (not null)
oid - is the identifier of the persistent instance (not null)
Returns:
the previous associated identifier of a persistent instance associated to the specified user key. The null value is returned if no entry was previously bound.

unbindFromKey

public java.lang.Object unbindFromKey(java.lang.Object key)
Forces the eviction of an entry from an user key

Parameters:
key - is the user key of a persistent instance (not null)
Returns:
the object identifier if found, otherwise null

unbindFromOID

public java.lang.Object unbindFromOID(java.lang.Object oid)
Forces the eviction of an entry from an object identifier

Parameters:
oid - is the identifier of a persistent instance (not null)
Returns:
the user key if found, otherwise null

getName

public java.lang.String getName()

getId

public int getId()

isActive

public boolean isActive()

getIndexFieldNames

public java.lang.String[] getIndexFieldNames()