© 2004 BEA Systems, Inc.

com.bea.p13n.cache
Class CacheFactory

java.lang.Object
  extended bycom.bea.p13n.cache.CacheFactory

public class CacheFactory
extends Object

Factory to create Singleton Cache objects. This implementation can be used by clients running inside of the CacheMBean application context (eg, most EJBs) as well as clients running outside of that context (eg, JDBC Connection Pools).


Constructor Summary
CacheFactory()
           
 
Method Summary
static boolean cacheExists(String cacheName)
          Determine whether named cache exists in our collection
static Cache getCache(String name)
          Create a new or access an existing Cache.
static String[] getCacheNames()
          Returns all Cache names
static void removeCache(String cacheName)
          Remove a cache from the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheFactory

public CacheFactory()
Method Detail

cacheExists

public static boolean cacheExists(String cacheName)
Determine whether named cache exists in our collection

Returns:
true if exists, false otherwise

getCache

public static Cache getCache(String name)
Create a new or access an existing Cache.

If the cache has been pre-configured using MBeans, then create an instance of a cache with those parameters and return it. If the cache has not been pre-configured with MBeans, then create a cache with default parameters (defined in CacheDefaults) and return it.

If the cache exists already in the CacheFactory's collection (eg, it has been created by a previous call to CacheFactory.getCache()), then return an instance of that named cache.

Parameters:
name - the name of the cache to create or retrieve
Returns:
the cache that was created or retrieved.
See Also:
CacheDefaults

getCacheNames

public static String[] getCacheNames()
Returns all Cache names


removeCache

public static void removeCache(String cacheName)
Remove a cache from the system. Clear cache before setting to null and removing it from our collection. Allows the Garbage Collector to clean up.

Parameters:
cacheName - The name of the cache to remove.

© 2004 BEA Systems, Inc.

Copyright © 2004 BEA Systems, Inc. All Rights Reserved