ojb.broker.cache
Class PermanentObjectCacheImpl

java.lang.Object
  |
  +--ojb.broker.cache.PermanentObjectCacheImpl
All Implemented Interfaces:
ObjectCache

public class PermanentObjectCacheImpl
extends java.lang.Object
implements ObjectCache

This is an implementation of the ObjectCache interface that caches all objects in memory regardless of memory consumption.
It is not intended to be used as the main ObjectCache but only to be used in conjunction with the MultipleObjectCacheImpl for special object classes. It should only be used for objects which are few in number and not too big in size but expensive to re-create from the DB.

Author:
R Bischof

Field Summary
protected  java.util.Map cachedObjects
          holds all cached object identities
 
Constructor Summary
PermanentObjectCacheImpl()
           
 
Method Summary
 void cache(Identity oid, java.lang.Object obj)
          Caches the given object
 void cache(java.lang.Object obj)
          Caches the given object
 void clear()
          Clears the cache
 java.lang.Object lookup(Identity oid)
          Looks up the cache for an object that matches the given identity
 void remove(java.lang.Object obj)
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cachedObjects

protected java.util.Map cachedObjects
holds all cached object identities

Constructor Detail

PermanentObjectCacheImpl

public PermanentObjectCacheImpl()
Method Detail

cache

public void cache(java.lang.Object obj)
Caches the given object

Specified by:
cache in interface ObjectCache
Parameters:
obj - The object to cache

clear

public void clear()
Clears the cache

Specified by:
clear in interface ObjectCache

cache

public void cache(Identity oid,
                  java.lang.Object obj)
Caches the given object

Specified by:
cache in interface ObjectCache
Parameters:
oid - The identity of the given object to cache
obj - The object to cache

lookup

public java.lang.Object lookup(Identity oid)
Looks up the cache for an object that matches the given identity

Specified by:
lookup in interface ObjectCache
Parameters:
oid - The identity of the object to look up
Returns:
The object if found, otherwise null

remove

public void remove(java.lang.Object obj)
Description of the Method

Specified by:
remove in interface ObjectCache
Parameters:
obj - Description of Parameter


Authors: Thomas Mahler and others. (C) 2000, 2001.
All rights reserved. Published under the Gnu Public License.
http://objectbridge.sourceforge.net
Version: 0.8.375, 2002-04-04