# com.bea.p13n.cache
CacheFactory Class

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).

Hierarchy
  `Object`
  `CacheFactory`

## Constructor Summary

CacheFactory()

## Method Summary

`public static boolean` | `cacheExists`(`String` cacheName) Determine whether named cache exists in our collection
`public static `Cache`` | `getCache`(`String` name) Create a new or access an existing Cache.
`public static `String`[]` | `getCacheNames`() Returns all Cache names
`public static void` | `removeCache`(`String` cacheName) Remove a cache from the system.

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Detail

### CacheFactory

    public CacheFactory()

## Method Detail

### cacheExists(String) Method

    public static boolean cacheExists(String cacheName)

Determine whether named cache exists in our collection

#### Returns

true if exists, false otherwise

### getCache(String) Method

    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.

Related Topics

``CacheDefaults``

### getCacheNames() Method

    public static String[] getCacheNames()

Returns all Cache names

### removeCache(String) Method

    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.