org.exolab.castor.jdo

Class CacheManager


public class CacheManager
extends java.lang.Object

CacheManager handles expiring objects from the cache. CacheManager is created from DatabaseImpl and should not be instantiated manually.
Version:
$Revision: 6024 $ $Date: 2006-04-22 11:05:30 -0600 (Sat, 22 Apr 2006) $
Author:
Stein M. Hugubakken

Constructor Summary

CacheManager(Database db, TransactionContext transactionContext, LockEngine lockEngine)
Creates an instance of this class.

Method Summary

void
dumpCache()
Dump all cached objects to log.
void
dumpCache(Class cls)
Dump cached objects of specific type to log.
void
expireCache()
Expires all objects from cache.
void
expireCache(Class type, Object identity)
Expires a type with a specific identity from cache.
void
expireCache(Class type, Object[] identity)
Expires a type with specific identities from cache.
void
expireCache(Class[] type)
Expires all instances of specified types from cache.
boolean
isCached(Class cls, Object identity)
Indicates whether am instance of cls is currently cached

Constructor Details

CacheManager

public CacheManager(Database db,
                    TransactionContext transactionContext,
                    LockEngine lockEngine)
Creates an instance of this class.
Parameters:
db - Database instance.
transactionContext - Active transaction context.
lockEngine - Lock engine

Method Details

dumpCache

public void dumpCache()
Dump all cached objects to log.

dumpCache

public void dumpCache(Class cls)
Dump cached objects of specific type to log.

expireCache

public void expireCache()
Expires all objects from cache.

Objects expired from the cache will be read from persistent storage, as opposed to being read from the performance cache, during subsequent load/query operations.

When objects are expired from the cache individually, by identity, objects contained within a "master" object, for example objects maintained in a one-to-many relationship, will automatically be expired from the cache, without the need to explicitly identify them. This does not apply when expiring objects by type. Each type, both container and contained objects need to be specified.


expireCache

public void expireCache(Class type,
                        Object identity)
            throws PersistenceException
Expires a type with a specific identity from cache.

Objects expired from the cache will be read from persistent storage, as opposed to being read from the performance cache, during subsequent load/query operations.

When objects are expired from the cache individually, by identity, objects contained within a "master" object, for example objects maintained in a one-to-many relationship, will automatically be expired from the cache, without the need to explicitly identify them. This does not apply when expiring objects by type. Each type, both container and contained objects need to be specified.

Parameters:
type - The type to expire.
identity - Identity of the object to expire.

expireCache

public void expireCache(Class type,
                        Object[] identity)
            throws PersistenceException
Expires a type with specific identities from cache.

Objects expired from the cache will be read from persistent storage, as opposed to being read from the performance cache, during subsequent load/query operations.

When objects are expired from the cache individually, by identity, objects contained within a "master" object, for example objects maintained in a one-to-many relationship, will automatically be expired from the cache, without the need to explicitly identify them. This does not apply when expiring objects by type. Each type, both container and contained objects need to be specified.

Parameters:
type - The type to expire.
identity - An array of object identifiers to expire.

expireCache

public void expireCache(Class[] type)
Expires all instances of specified types from cache.

Objects expired from the cache will be read from persistent storage, as opposed to being read from the performance cache, during subsequent load/query operations.

When objects are expired from the cache individually, by identity, objects contained within a "master" object, for example objects maintained in a one-to-many relationship, will automatically be expired from the cache, without the need to explicitly identify them. This does not apply when expiring objects by type. Each type, both container and contained objects need to be specified.

Parameters:
type - An array of types to expire.

isCached

public boolean isCached(Class cls,
                        Object identity)
            throws PersistenceException
Indicates whether am instance of cls is currently cached
Parameters:
cls - The class type.
identity - The object identity.
Returns:
True if the object is cached.
Throws:
PersistenceException - If a problem occured resolving the object's cache membership.

Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com