|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ojb.broker.cache.MetaObjectCacheImpl
This cache makes it possible to have separate cache implementations for
each class. When an object is cached / looked up the MetaObjectCacheImpl
checks if a special ObjectCache has been set for this class. It recursively
looks up the superclasses of the given object to look for a special cache. If
no special cache is found it uses the ObjectCacheDefaultImpl to cache the
object.
It is also possible to switch off caching for a specific class by setting
the object cache to null.
Constructor Summary | |
MetaObjectCacheImpl()
Constructor for the MetaObjectCacheImpl object |
Method Summary | |
void |
cache(Identity oid,
java.lang.Object obj)
Caches the given object using the given Identity as key |
void |
cache(java.lang.Object obj)
Caches the given Object |
void |
clear()
Clears the cache |
java.lang.Object |
lookup(Identity oid)
Looks up the object from the cache |
void |
remove(java.lang.Object obj)
Removes the given object from the cache |
protected void |
removeByOID(Identity oid)
Removes the object identified by the given Identity from the cache |
void |
setClassCache(java.lang.Class objectClass,
ObjectCache cache)
Sets the ObjectCache implementation to use for objects with the given type and subclasses |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MetaObjectCacheImpl()
Method Detail |
public void setClassCache(java.lang.Class objectClass, ObjectCache cache)
objectClass
- The object's class, use java.lang.Object to alter
default caching for all objects which have no special
caching definedcache
- The new ObjectCache implementation to use for this
class and subclasses, null to switch off caching
for the given classpublic void cache(java.lang.Object obj)
cache
in interface ObjectCache
obj
- The object to cachepublic void cache(Identity oid, java.lang.Object obj)
cache
in interface ObjectCache
oid
- The Identity keyobj
- The object o cachepublic java.lang.Object lookup(Identity oid)
lookup
in interface ObjectCache
oid
- The Identity to look up the object for
protected void removeByOID(Identity oid)
oid
- The identity of the object to removepublic void remove(java.lang.Object obj)
remove
in interface ObjectCache
obj
- The object to removepublic void clear()
clear
in interface ObjectCache
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |