org.ehcache.PersistentCacheManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache-api Show documentation
Show all versions of ehcache-api Show documentation
The API module of Ehcache 3
/*
* 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 {@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 {@code PersistentCacheManager}.
*
* 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 {@link Cache} instance managed
* by this {@link org.ehcache.CacheManager}.
*
* This requires the {@code CacheManager} to be either in {@link Status#AVAILABLE AVAILABLE} or
* {@link Status#MAINTENANCE MAINTENANCE} mode.
*
* - If the {@code CacheManager} is {@code AVAILABLE}, the operation is executed without lifecycle interactions.
* - 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.
*
*
* @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;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy