|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The ObjectCache stores all Objects loaded by the PersistenceBroker from a DB. When the PersistenceBroker tries to get an Object by its Primary key values it first lookups the cache if the object has been already loaded and cached. Using an ObjectCache has several advantages: - it increases performance as it reduces DB lookups. - it allows to perform circular lookups (as by crossreferenced objects) that would result in non-terminating loops without such a cache. - it maintains the uniqueness of objects as any Db row will be mapped to exactly one object. This interface allows to have userdefined Cache implementations. The ObjectCacheFactory is responsible for generating cache instances. by default it uses the OJB ObjectCacheDefaultImpl.
Method Summary | |
void |
cache(Identity oid,
java.lang.Object obj)
makes object obj persistent to the Objectcache under the key oid. |
void |
cache(java.lang.Object obj)
Make object obj persistent to Objectcache. |
void |
clear()
clear the ObjectCache. |
java.lang.Object |
lookup(Identity oid)
Lookup object with Identity oid in objectTable. |
void |
remove(java.lang.Object obj)
removes an Object from the cache. |
Method Detail |
public void cache(java.lang.Object obj) throws ClassNotPersistenceCapableException
ClassNotPersistenceCapableException
public void cache(Identity oid, java.lang.Object obj)
public java.lang.Object lookup(Identity oid)
public void remove(java.lang.Object obj)
obj
- the Object (or the Identity of the object) to be removed.public void clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |