Skip to content

Package: CacheManager

CacheManager

Coverage

1: /*
2: * Copyright (c) 2012, 2017 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.glassfish.grizzly.memcached;
18:
19: /**
20: * The interface for managing caches based on JSR-107(JCache)
21: *
22: * @author Bongjae Chang
23: */
24: public interface CacheManager {
25: /**
26: * Creates a new {@link CacheBuilder} for the named cache to be managed by this cache manager.
27: * <p>
28: * The returned CacheBuilder is associated with this CacheManager.
29: * The Cache will be created, added to the caches controlled by this CacheManager and started when
30: * {@link CacheBuilder#build()} is called.
31: *
32: * @param cacheName the name of the cache to build. A cache name must consist of at least one non-whitespace character.
33: * @return the CacheBuilder for the named cache
34: */
35: public <K, V> CacheBuilder<K, V> createCacheBuilder(final String cacheName);
36:
37: /**
38: * Looks up a named cache.
39: *
40: * @param cacheName the name of the cache to look for
41: * @return the Cache or null if it does exist
42: */
43: public <K, V> Cache<K, V> getCache(final String cacheName);
44:
45: /**
46: * Remove a cache from the CacheManager. The cache will be stopped.
47: *
48: * @param cacheName the cache name
49: * @return true if the cache was removed
50: */
51: public boolean removeCache(final String cacheName);
52:
53: /**
54: * Shuts down the CacheManager.
55: */
56: public void shutdown();
57: }