Ehcaches that maintain all aspects of their lifecycle.
CacheManager may be either be a singleton if created with factory methods, or multiple instances may exist, in which case resources required by each must be unique.
A CacheManager holds references to Caches and Ehcaches and manages their creation and lifecycle.
| Modifier and Type | Field and Description |
|---|---|
| public static final List | ALL_CACHE_MANAGERS
Keeps track of all known CacheManagers. |
| private static final Map | |
| private static final IdentityHashMap | |
| protected final CacheManagerEventListenerRegistry | cacheManagerEventListenerRegistry
The listener registry |
| protected final Map | cacheManagerPeerListeners
The map of listeners |
| protected final Map | cacheManagerPeerProviders
The map of providers |
| private FailSafeTimer | |
| public static final String | DEFAULT_NAME
Default name if not specified in the configuration/ |
| private Ehcache | defaultCache
Default cache cache. |
| private static final long | DELAY_UPDATE_CHECK
delay period before doing update check |
| private DiskStorePathManager | diskStorePathManager
The path for the directory in which disk caches are created. |
| private final ConcurrentMap | ehcaches
Ehcaches managed by this manager. |
| public static final String | ENABLE_SHUTDOWN_HOOK_PROPERTY
System property to enable creation of a shutdown hook for CacheManager. |
| private static final long | EVERY_WEEK
Update check interval - one week in milliseconds |
| private volatile FeaturesManager | |
| private static final Map | |
| private final Map | |
| pack-priv static final String | |
| private static final long | |
| private volatile Thread | |
| private static final Logger | |
| private volatile ManagementEventSink | |
| private static final MBeanRegistrationProviderFactory | MBEAN_REGISTRATION_PROVIDER_FACTORY
The factory to use for creating MBeanRegistrationProvider's |
| private MBeanRegistrationProvider | |
| private static final String | |
| public static final double | ON_HEAP_THRESHOLD
Threshold, in percent of the available heap, above which the CacheManager will warn if the configured memory |
| private volatile Pool | |
| private volatile Pool | |
| private static final int | POOL_SHUTDOWN_TIMEOUT_SECS
Default timeout in seconds to wait for stats thread pool to shutdown |
| private String | |
| private volatile Configuration. | |
| protected Thread | shutdownHook
The shutdown hook thread for CacheManager. |
| private static volatile CacheManager | singleton
The Singleton Instance. |
| private final ConcurrentMap | |
| private ScheduledExecutorService | statisticsExecutor
Statistics thread pool. |
| protected volatile Status | status
Status of the Cache Manager |
| private volatile TerracottaClient | |
| private volatile TransactionController | |
| private volatile DelegatingTransactionIDFactory | |
| private volatile TransactionManagerLookup |
| Access | Constructor and Description |
|---|---|
| public | CacheManager(Configuration configuration)
An constructor for CacheManager, which takes a configuration object, rather than one created by parsing an ehcache.xml file. |
| public | CacheManager(String
an xml configuration file available through a file name. The configuration configurationFileName)File is created
using new File(configurationFileName)An ordinary constructor for CacheManager. |
| public | CacheManager(URL
an xml configuration available through a URL. configurationURL)An ordinary constructor for CacheManager. |
| public | CacheManager(InputStream
an xml configuration file available through an inputstream configurationInputStream)An ordinary constructor for CacheManager. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| public void | |
| public synchronized void | |
| public synchronized Ehcache | Returns: the instance registered with the CacheManager, the cache instance passed in if it was added; or null if Ehcache is nullThe Ehcache to be added cache)Only adds the cache to the CacheManager should not one with the same name already be present |
| public synchronized Ehcache | Returns: the Ehcache instance created and registered; null if cacheName was null or of length 0the name of the Cache to be created cacheName)Only creates and adds the cache to the CacheManager should not one with the same name already be present |
| private Ehcache | |
| private void | |
| public synchronized void | |
| public synchronized void | addDecoratedCacheIfAbsent(Ehcache decoratedCache)
Same as |
| private void | |
| private void | addShutdownHookIfRequired()
Some caches might be persistent, so we want to add a shutdown hook if that is the case, so that the data and index can be written to disk. |
| private void | |
| private void | |
| private void | |
| public boolean | Returns: true if it existsthe cache name to check for cacheName)Checks whether a cache of type ehcache exists. |
| protected void | |
| public void | |
| public void | clearAllStartingWith(String
The prefix the cache name should start with prefix)Clears the contents of all caches in the CacheManager with a name starting with the prefix, but without removing them. |
| private Ehcache | |
| private void | |
| public static CacheManager | Returns: the singleton CacheManagerA factory method to create a singleton CacheManager with default config, or return it if it exists. |
| public static CacheManager | create(String
an xml file compliant with the ehcache.xsd schema
configurationFileName)
The configuration will be read, A factory method to create a singleton CacheManager with a specified configuration. |
| public static CacheManager | create(URL
an URL to an xml file compliant with the ehcache.xsd schema
configurationFileURL)
The configuration will be read, A factory method to create a singleton CacheManager from an URL. |
| public static CacheManager | create(InputStream
InputStream of xml compliant with the ehcache.xsd schema
inputStream)
The configuration will be read, A factory method to create a singleton CacheManager from a java.io.InputStream. |
| public static CacheManager | create(Configuration config)
A factory method to create a singleton CacheManager from a net.sf.ehcache.config.Configuration. |
| private List | |
| pack-priv SizeOfEngine | Returns: a SizeOfEngine instanceThe cache to be sized by the engine cache)Creates a SizeOfEngine for a cache. |
| pack-priv SoftLockManager | Returns: a SoftLockManagerthe cache to create the soft lock manager for cache)Create a soft lock manager for a specific cache |
| public CacheEventListener | Returns: a new cache event replicatorThe cache for which the clustered event replicator should be created cache)Create/access the appropriate clustered cache event replicator for the given cache |
| public Store | Returns: a new (or existing) clustered storeThe cache for which the Store should be created cache)Create/access the appropriate terracotta clustered store for the given cache |
| public WriteBehind | Returns: a new (or existing) write behind queueThe cache for which the write behind queue should be created cache)Create/access the appropriate clustered write behind queue for the given cache |
| private void | |
| private void | |
| public String | Returns: Returns the active configuration text for thisCacheManagerReturns the active configuration text for this |
| public String | Returns: Returns the active configuration text for the input cacheNameReturns the active configuration text for the input cacheName |
| public Cache | |
| public static CacheManager | Returns: if a cacheManager exists with given name returns the CacheManager, otherwise returns null. Ifname is null,
returns the default unnamed cacheManager if it has been created
already otherwise returns nullthe cacheManager name. name)Checks if a cacheManager already exists for a given name and gets it. |
| public CacheManagerEventListener | |
| public CacheManagerEventListenerRegistry | |
| public CacheManagerPeerProvider | Returns: the provider, or null if one does not existthe replication scheme to use. Schemes shipped with ehcache are RMI, JGROUPS, JMS scheme)Gets the |
| public Map | Returns: Read-only map of the registeredCacheManagerPeerProviders keyed by scheme.
|
| public String[] | |
| public CacheManagerPeerListener | Returns: the listener, or null if one does not existthe replication scheme to use. Schemes shipped with ehcache are RMI, JGROUPS, JMS scheme)When CacheManage is configured as part of a cluster, a CacheManagerPeerListener will be registered in it. |
| private ClassLoader | |
| private static String | |
| public CacheCluster | Returns: Cluster API (never null, but possibly a simple single node implementation)The clustering scheme to retrieve information about (such as "Terracotta") scheme)Returns access to information about the cache cluster. |
| protected ClusteredInstanceFactory | Returns: the clustered instance factoryReturn the clustered instance factory for a cache of this cache manager. |
| public String | Returns: Returns unique cluster-wide id for this cache-manager when it contains clustered caches (e.g. Terracotta clustered caches). Otherwise returns blank string.Returns unique cluster-wide id for this cache-manager. |
| public Configuration | |
| private ManagementRESTServiceConfiguration | |
| public DiskStorePathManager | |
| public Ehcache | Returns: a Cache, if an object of type Cache exists by that name, else nullGets an Ehcache
|
| public FeaturesManager | |
| pack-priv static CacheManager | Returns: theCacheManager if it exists.name of the name)CacheManager; can be nullGet a currently initializing |
| public static CacheManager | Returns: the singleton CacheManagerA factory method to create a singleton CacheManager with default config, or return it if it exists. |
| public String | Returns: the name, or the output of toString() if it is not set.Gets the name of the CacheManager. |
| public Pool | Returns: this cache manager's shared on-disk poolReturn this cache manager's shared on-disk pool |
| public Pool | Returns: this cache manager's shared on-heap poolReturn this cache manager's shared on-heap pool |
| private ManagementEventSink | |
| public TransactionIDFactory | Returns: a TransactionIDFactoryGet or create a TransactionIDFactory |
| public String | Returns: Returns the original configuration text for thisCacheManagerReturns the original configuration text for this |
| public String | Returns: Returns the original configuration text for the input cacheNameReturns the original configuration text for the input cacheName |
| private String | |
| pack-priv ScheduledExecutorService | Returns: this cache manager's statistics executorReturn this cache manager's statistics executor |
| public Status | Returns: The status value from the Status enum classGets the status attribute of the Ehcache |
| public FailSafeTimer | Returns: TheFailSafeTimer associated with this cache managerReturns a |
| public TransactionController | |
| protected synchronized void | init(Configuration
the initial configuration initialConfiguration, String the name of the configuration file configurationFileName, URL the configuration URL configurationURL, InputStream the configuration input stream configurationInputStream)initialises the CacheManager |
| pack-priv void | initializeEhcache(final Ehcache cache, final boolean registerCacheConfig)
Initialize the given |
| private void | |
| private void | |
| public boolean | |
| public static CacheManager | Returns: the singleton CacheManagerA factory method to create a CacheManager with default config, or return it if it exists. |
| public static CacheManager | newInstance(String
an xml file compliant with the ehcache.xsd schema
configurationFileName)
The configuration will be read, A factory method to create a CacheManager with a specified configuration. |
| public static CacheManager | newInstance(URL
an URL to an xml file compliant with the ehcache.xsd schema
configurationFileURL)
The configuration will be read, A factory method to create a CacheManager from an URL. |
| public static CacheManager | newInstance(InputStream
InputStream of xml compliant with the ehcache.xsd schema
inputStream)
The configuration will be read, A factory method to create a CacheManager from a java.io.InputStream. |
| public static CacheManager | newInstance(Configuration config)
A factory method to create a CacheManager from a net.sf.ehcache.config.Configuration. |
| private static CacheManager | Returns: a new cacheManager or an already existing one in the VM with same namethe configuration object configuration, String Message printed when creating new cacheManager msg)Returns a new cacheManager or returns already created one. |
| private synchronized Configuration | Returns: the loaded configurationthe file name to parse, or null configurationFileName, URL the URL to pass, or null configurationURL, InputStream , the InputStream to parse, or null configurationInputStream)Loads configuration, either from the supplied |
| private void | |
| public void | removalAll()
Deprecated
use
Removes all caches using removeAllCaches instead
removeCache(String) for each cache.
|
| public void | |
| public synchronized void | |
| private void | |
| public synchronized void | replaceCacheWithDecoratedCache(Ehcache ehcache, Ehcache
An implementation of Ehcache that wraps the original cache. decoratedCache)Replaces in the map of Caches managed by this CacheManager an Ehcache with a decorated version of the same Ehcache. |
| private FeaturesManager | |
| public void | sendManagementEvent(Serializable
the event (most probably an EventEntity) event, String the type of the event type)Send a management event to the cluster |
| public void | setCacheManagerEventListener(CacheManagerEventListener
the listener to set. cacheManagerEventListener)Same as getCacheManagerEventListenerRegistry().registerListener(cacheManagerEventListener); Left for backward compatiblity |
| public void | |
| public String | Returns: either the name of this CacheManager, or if unset, Object.toString()Overrides java. |