ehcache

net.sf.ehcache.management
Class Cache

java.lang.Object
  extended by net.sf.ehcache.management.Cache
All Implemented Interfaces:
Serializable, CacheMBean

public class Cache
extends Object
implements CacheMBean, Serializable

A Cache implementation that supports JMX MBeans

Since:
1.3
Version:
$Id: Cache.java 9254 2014-08-26 08:14:24Z sund $
Author:
Greg Luck
See Also:
Serialized Form

Constructor Summary
Cache(Ehcache cache)
          A constructor for JCache.
 
Method Summary
 void flush()
          Flushes all cache items from memory to the disk store, and from the DiskStore to disk.
 CacheConfiguration getCacheConfiguration()
          Gets the JMX read-only CacheConfiguration
 String getName()
          Gets the cache name.
 CacheStatistics getStatistics()
          Gets the JMX cache statistics
 String getStatus()
          Gets the status attribute of the Cache.
 boolean hasAbortedSizeOf()
          May the cache contain elements which the SizeOf engine could not fully size?
 boolean isTerracottaClustered()
          Is the cache configured with Terracotta clustering?
 void removeAll()
          Removes all cached items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cache

public Cache(Ehcache cache)
      throws CacheException
A constructor for JCache. JCache is an adaptor for an Ehcache, and therefore requires an Ehcace in its constructor.

The ConfigurationFactory and clients can create these.

A client can specify their own settings here and pass the Ehcache object into CacheManager.addCache(java.lang.String) to specify parameters other than the defaults.

Only the CacheManager can initialise them.

Parameters:
cache - An ehcache
Throws:
CacheException
Method Detail

removeAll

public void removeAll()
               throws IllegalStateException,
                      CacheException
Removes all cached items.

Specified by:
removeAll in interface CacheMBean
Throws:
IllegalStateException - if the cache is not Status.STATUS_ALIVE
CacheException

flush

public void flush()
           throws IllegalStateException,
                  CacheException
Flushes all cache items from memory to the disk store, and from the DiskStore to disk.

Specified by:
flush in interface CacheMBean
Throws:
IllegalStateException - if the cache is not Status.STATUS_ALIVE
CacheException

getStatus

public String getStatus()
Gets the status attribute of the Cache.

Specified by:
getStatus in interface CacheMBean
Returns:
The status value as a String from the Status enum class

getName

public String getName()
Gets the cache name.

Specified by:
getName in interface CacheMBean

isTerracottaClustered

public boolean isTerracottaClustered()
Is the cache configured with Terracotta clustering?

Specified by:
isTerracottaClustered in interface CacheMBean

hasAbortedSizeOf

public boolean hasAbortedSizeOf()
May the cache contain elements which the SizeOf engine could not fully size?

Specified by:
hasAbortedSizeOf in interface CacheMBean

getCacheConfiguration

public CacheConfiguration getCacheConfiguration()
Gets the JMX read-only CacheConfiguration

Specified by:
getCacheConfiguration in interface CacheMBean

getStatistics

public CacheStatistics getStatistics()
Gets the JMX cache statistics

Specified by:
getStatistics in interface CacheMBean

ehcache

Copyright 2001-2014, Terracotta, Inc.