# com.bea.p13n.mbeans
CacheMBean Interface

public interface CacheMBean
extends `CacheConfig`, `ServiceConfigurationMBean`

The MBean that configures individual instances of a cache. The name of this MBean corresponds to the name of the cache (as retrieved from CacheFactoy.getCache(name)). If this MBean does not exist for a cache, the CacheFactory will pick appropriate values (usually the defaults) for a new cache.

Related Topics

``Cache``
``CacheFactory``

All Superinterfaces
  `CacheConfig`, `ConfigurationMBean`, `DynamicMBean`, `MBeanRegistration`, `NotificationBroadcaster`, `ServiceConfigurationMBean`, `WebLogicMBean`

## Field Summary

Fields from interface com.bea.p13n.cache.internal.system`.`CacheConfig``
`DEFAULT_ENABLED, DEFAULT_MAX_ENTRIES, DEFAULT_TTL, MAX_ENTRIES_MAX, TTL_NEVER_EXPIRE`

Fields from interface weblogic.management.configuration`.`ConfigurationMBean``
`CACHING_STUB_SVUID, DEFAULT_EMPTY_BYTE_ARRAY`

## Method Summary

`public boolean` | `getEnabled`() Get enabled mode of cache.
`public int` | `getMaxEntries`() Get maximum number of entries allowed in the cache.
`public long` | `getTimeToLive`() Get default time to live for cache elements (in milliseconds).
`public void` | `setEnabled`(boolean isEnabled) Set enabled mode of cache.
`public void` | `setMaxEntries`(int size) Set the maximum number of entries allowed in the cache.
`public void` | `setTimeToLive`(long ttl) Set the default time-to-live (in millisec) for elements added to the cache.

Methods from interface `weblogic.management.configuration.`ConfigurationMBean``
`freezeCurrentValue, getAttributeStringValue, getComments, getNotes, getSetFields, getXml, getXmlConverter, isDefaultedMBean, isPersistenceEnabled, preDeregister, registerConfigMBean, restoreDefaultValue, setComments, setDefaultedMBean, setNotes, setPersistenceEnabled, touch, unRegisterConfigMBean`

Methods from interface `javax.management.`DynamicMBean``
`getAttribute, getAttributes, getMBeanInfo, invoke, setAttribute, setAttributes`

Methods from interface `javax.management.`MBeanRegistration``
`postDeregister, postRegister, preDeregister, preRegister`

Methods from interface `javax.management.`NotificationBroadcaster``
`addNotificationListener, getNotificationInfo, removeNotificationListener`

Methods from interface `com.bea.p13n.management.`ServiceConfigurationMBean``
``

Methods from interface `weblogic.management.`WebLogicMBean``
`getMBeanInfo, getName, getObjectName, getParent, getType, isCachingDisabled, isRegistered, setName, setParent`

## Method Detail

### getEnabled() Method

    public boolean getEnabled()

Get enabled mode of cache.

### getMaxEntries() Method

    public int getMaxEntries()

Get maximum number of entries allowed in the cache.

### getTimeToLive() Method

    public long getTimeToLive()

Get default time to live for cache elements (in milliseconds).

### setEnabled(boolean) Method

    public void setEnabled(boolean isEnabled)

Set enabled mode of cache. Disabling the cache will cause fetch, add, and remove to do nothing.

The cache may be cleared of its contents by checking the "flush" tab on the cache administration console.

#### Parameters

isEnabled
  Enabled state of the cache

### setMaxEntries(int) Method

    public void setMaxEntries(int size)

Set the maximum number of entries allowed in the cache. If the number of elements in the cache exceeds this size, older elements will be removed (using an LRU strategy).

#### Parameters

size
  Maximum number of elements allowed in the cache

### setTimeToLive(long) Method

    public void setTimeToLive(long ttl)

Set the default time-to-live (in millisec) for elements added to the cache. Must be set to a positive number or to TTL_NEVER_EXPIRE.

#### Parameters

ttl
  Default time to live for cache elements, in milliseconds