org.neodatis.odb.core.transaction
Interface ICrossSessionCache

All Known Implementing Classes:
CrossSessionCache

public interface ICrossSessionCache

This interface define the control over objects alive across different sessions. It is a wrapper for all objects put into cross cache. It's primary purpose is to maintain references to the linked objects that has been used. Different strategies can be used on the implementations to support the idea of a cache based on weak reference.

Since:
1.9

Method Summary
 void addObject(java.lang.Object object, OID oid)
          Associates the specified OID with the specified object(key) in this cache
 void clear()
          Removes all mappings from this cache.
 boolean existObject(java.lang.Object object)
          Returns true if this cache maps one key to the specified object.
 OID getOid(java.lang.Object object)
          Return the specific OID
 boolean isEmpty()
          Returns true if this map contains no key-value mappings.
 void removeObject(java.lang.Object object)
          Removes the mapping for this object from this cache if it is present.
 void removeOid(OID oid)
          Mark the object with the oid as deleted.
 int size()
          Returns the number of key-value mappings in this cache.
 java.lang.String toString()
          Returns a String writing down the objects
 

Method Detail

addObject

void addObject(java.lang.Object object,
               OID oid)
Associates the specified OID with the specified object(key) in this cache

Parameters:
object - The key. This parameter can not be null
{@link - OID} The value. It is transformed to use weak reference for the keys.

removeObject

void removeObject(java.lang.Object object)
Removes the mapping for this object from this cache if it is present.

Parameters:
object - that contains the reference to OID. This parameter can not be null

removeOid

void removeOid(OID oid)
Mark the object with the oid as deleted.

Parameters:
oid - that must be marked as deleted.
            When objects are deleted by oid, the cost is too high to search the object by the oid, so we just keep the deleted oid,
 and when looking for an object, check if the oid if is the deleted oids
            
            

existObject

boolean existObject(java.lang.Object object)
Returns true if this cache maps one key to the specified object.

Parameters:
object -
Returns:
boolean

getOid

OID getOid(java.lang.Object object)
Return the specific OID

Parameters:
object - The key on the cache for a OID. This parameter can not be null
Returns:
OID. Returns null in case no find key.

isEmpty

boolean isEmpty()
Returns true if this map contains no key-value mappings.

Returns:
boolean

clear

void clear()
Removes all mappings from this cache.


toString

java.lang.String toString()
Returns a String writing down the objects

Overrides:
toString in class java.lang.Object
Returns:
String

size

int size()
Returns the number of key-value mappings in this cache.

Returns:
int The amount of objects on the cache