001package org.cache2k.spi;
002
003/*
004 * #%L
005 * cache2k API
006 * %%
007 * Copyright (C) 2000 - 2016 headissue GmbH, Munich
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import org.cache2k.Cache;
024import org.cache2k.CacheManager;
025import org.cache2k.configuration.Cache2kConfiguration;
026
027/**
028 * Interface to the cache2k implementation. This interface is not intended for the application
029 * usage. Use the static methods on the {@link CacheManager}.
030 *
031 * @author Jens Wilke; created: 2015-03-26
032 */
033public interface Cache2kCoreProvider {
034
035  /**
036   * @see CacheManager#setDefaultName(String)
037   */
038  void setDefaultManagerName(ClassLoader cl, String s);
039
040  /**
041   * @see CacheManager#getDefaultName()
042   */
043  String getDefaultManagerName(ClassLoader cl);
044
045  /**
046   * @see CacheManager#getInstance(ClassLoader, String)
047   */
048  CacheManager getManager(ClassLoader cl, String _name);
049
050  /**
051   * Default class loader, this is the class loader used to load the cache implementation.
052   */
053  ClassLoader getDefaultClassLoader();
054
055  /**
056   * Close all cache2k cache managers.
057   */
058  void close();
059
060  /**
061   * Close all cache manager associated to this class loader.
062   */
063  void close(ClassLoader l);
064
065  /**
066   * Close a specific cache manager by its name.
067   */
068  void close(ClassLoader l, String managerName);
069
070  /**
071   * Create a cache, apply external configuration before creating it.
072   */
073  <K,V> Cache<K,V> createCache(CacheManager m, Cache2kConfiguration<K,V> cfg);
074
075  /**
076   * Return the effective default configuration for this manager. A different default
077   * configuration may be provided by the configuration system.
078   *
079   * @return mutable configuration instance containing the effective configuration defaults, never {@code null}
080   */
081  Cache2kConfiguration getDefaultConfiguration(CacheManager m);
082
083}