001/* 002 * Copyright 2002-2019 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.cache; 018 019import java.util.Collection; 020 021import org.springframework.lang.Nullable; 022 023/** 024 * Spring's central cache manager SPI. 025 * 026 * <p>Allows for retrieving named {@link Cache} regions. 027 * 028 * @author Costin Leau 029 * @author Sam Brannen 030 * @since 3.1 031 */ 032public interface CacheManager { 033 034 /** 035 * Get the cache associated with the given name. 036 * <p>Note that the cache may be lazily created at runtime if the 037 * native provider supports it. 038 * @param name the cache identifier (must not be {@code null}) 039 * @return the associated cache, or {@code null} if such a cache 040 * does not exist or could be not created 041 */ 042 @Nullable 043 Cache getCache(String name); 044 045 /** 046 * Get a collection of the cache names known by this manager. 047 * @return the names of all caches known by the cache manager 048 */ 049 Collection<String> getCacheNames(); 050 051}