/*
* Copyright Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ehcache;
A CacheManager
that knows how to lifecycle caches that can outlive the JVM. /**
* A {@link CacheManager} that knows how to lifecycle caches that can outlive the JVM.
*/
public interface PersistentCacheManager extends CacheManager {
Destroys all persistent data associated with this PersistentCacheManager
. This is achieved by putting the CacheManager
in MAINTENANCE
mode, executing the destroy and then exiting the MAINTENANCE
mode.
Throws: - IllegalStateException – if state maintenance couldn't be reached
- CachePersistenceException – when something goes wrong destroying the persistent data
/**
* Destroys all persistent data associated with this {@code PersistentCacheManager}.
* <p>
* This is achieved by putting the {@code CacheManager} in {@link Status#MAINTENANCE MAINTENANCE} mode,
* executing the destroy and then exiting the {@code MAINTENANCE} mode.
*
* @throws IllegalStateException if state maintenance couldn't be reached
* @throws CachePersistenceException when something goes wrong destroying the persistent data
*/
void destroy() throws CachePersistenceException;
Destroys all data persistent data associated with the aliased Cache
instance managed by this CacheManager
. This requires the CacheManager
to be either in AVAILABLE
or MAINTENANCE
mode.
- If the
CacheManager
is AVAILABLE
, the operation is executed without lifecycle interactions.
- If the
CacheManager
is not AVAILABLE
then it attempts to go into MAINTENANCE
. Upon success, the destroyCache
operation is performed and then MAINTENANCE
mode is exited. On failure, an exception will be thrown and no destroy will have happened.
Params: - alias – the
Cache
's alias to destroy all persistent data from
Throws: - CachePersistenceException – when something goes wrong destroying the persistent data
/**
* Destroys all data persistent data associated with the aliased {@link Cache} instance managed
* by this {@link org.ehcache.CacheManager}.
* <p>
* This requires the {@code CacheManager} to be either in {@link Status#AVAILABLE AVAILABLE} or
* {@link Status#MAINTENANCE MAINTENANCE} mode.
* <ul>
* <li>If the {@code CacheManager} is {@code AVAILABLE}, the operation is executed without lifecycle interactions.</li>
* <li>If the {@code CacheManager} is not {@code AVAILABLE} then it attempts to go into {@code MAINTENANCE}.
* Upon success, the {@code destroyCache} operation is performed and then {@code MAINTENANCE} mode is exited.
* On failure, an exception will be thrown and no destroy will have happened.</li>
* </ul>
*
* @param alias the {@link org.ehcache.Cache}'s alias to destroy all persistent data from
*
* @throws CachePersistenceException when something goes wrong destroying the persistent data
*/
void destroyCache(String alias) throws CachePersistenceException;
}