org.apache.ojb.broker.cache
Class ObjectCacheJCSImpl

java.lang.Object
  extended by org.apache.ojb.broker.cache.ObjectCacheJCSImpl
All Implemented Interfaces:
ObjectCache

public class ObjectCacheJCSImpl
extends java.lang.Object
implements ObjectCache

This local ObjectCache implementation using turbine-JCS to cache objects is primarily for intern use in conjunction with ObjectCacheJCSPerClassImpl implementation. If used as main ObjectCache all cached objects will be cached under the same JCS region name (see DEFAULT_REGION).

Implementation configuration properties:

Property Key Property Values
- -

Version:
$Id: ObjectCacheJCSImpl.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Matthew Baird (mattbaird@yahoo.com);

Field Summary
static java.lang.String DEFAULT_REGION
          The used default region name.
 
Constructor Summary
ObjectCacheJCSImpl(PersistenceBroker broker, java.util.Properties prop)
           
ObjectCacheJCSImpl(java.lang.String name)
          Constructor used by the ObjectCacheJCSPerClassImpl
 
Method Summary
 void cache(Identity oid, java.lang.Object obj)
          makes object obj persistent to the Objectcache under the key oid.
 boolean cacheIfNew(Identity oid, java.lang.Object obj)
           
 void clear()
          clear the ObjectCache.
 java.lang.String getRegionName()
           
 java.lang.Object lookup(Identity oid)
          Lookup object with Identity oid in objectTable.
 void remove(Identity oid)
          removes an Object from the cache.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_REGION

public static final java.lang.String DEFAULT_REGION
The used default region name.

See Also:
Constant Field Values
Constructor Detail

ObjectCacheJCSImpl

public ObjectCacheJCSImpl(PersistenceBroker broker,
                          java.util.Properties prop)

ObjectCacheJCSImpl

public ObjectCacheJCSImpl(java.lang.String name)
Constructor used by the ObjectCacheJCSPerClassImpl

Method Detail

getRegionName

public java.lang.String getRegionName()

cache

public void cache(Identity oid,
                  java.lang.Object obj)
makes object obj persistent to the Objectcache under the key oid.

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

cacheIfNew

public boolean cacheIfNew(Identity oid,
                          java.lang.Object obj)

lookup

public java.lang.Object lookup(Identity oid)
Lookup object with Identity oid in objectTable. returns null if no matching id is found

Specified by:
lookup in interface ObjectCache
Parameters:
oid - Identity of the object to search for.
Returns:
The cached object or null if no matching object for specified Identity is found.

remove

public void remove(Identity oid)
removes an Object from the cache.

Specified by:
remove in interface ObjectCache
Parameters:
oid - the Identity of the object to be removed.

clear

public void clear()
clear the ObjectCache.

Specified by:
clear in interface ObjectCache

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30