Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
CacheManager | 33 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.cache; | |
21 | ||
22 | import org.xwiki.cache.config.CacheConfiguration; | |
23 | import org.xwiki.component.annotation.Role; | |
24 | import org.xwiki.component.manager.ComponentLookupException; | |
25 | ||
26 | /** | |
27 | * Choose the cache component to use for cache or local cache. | |
28 | * | |
29 | * @version $Id: 3a762b9e6d6fb5ecd6614c41dde293c5ffd0927f $ | |
30 | * @since 1.7M1 | |
31 | */ | |
32 | @Role | |
33 | public interface CacheManager | |
34 | { | |
35 | /** | |
36 | * Lookup the cache creation component with provided hint return it. | |
37 | * | |
38 | * @return the cache creation service to use. | |
39 | * @throws ComponentLookupException error when searching for cache component. | |
40 | */ | |
41 | CacheFactory getCacheFactory() throws ComponentLookupException; | |
42 | ||
43 | /** | |
44 | * Lookup the local cache creation component with provided hint return it. | |
45 | * | |
46 | * @return the local cache creation service to use. | |
47 | * @throws ComponentLookupException error when searching for cache component. | |
48 | */ | |
49 | CacheFactory getLocalCacheFactory() throws ComponentLookupException; | |
50 | ||
51 | /** | |
52 | * Find the cache implementation component to use and create a new cache. | |
53 | * | |
54 | * @param <T> the class of the data stored in the cache. | |
55 | * @param config the cache configuration. | |
56 | * @return a new {@link Cache}. | |
57 | * @throws CacheException error when creating the cache. | |
58 | */ | |
59 | <T> Cache<T> createNewCache(CacheConfiguration config) throws CacheException; | |
60 | ||
61 | /** | |
62 | * Find the local cache implementation component to use and create a new cache. | |
63 | * <p> | |
64 | * The new cache is based on a local storing implementation (to oppose to distributed cache) and is generally used | |
65 | * for not big cache needing very quick access to datas. | |
66 | * | |
67 | * @param <T> the class of the data stored in the cache. | |
68 | * @param config the cache configuration. | |
69 | * @return a new local {@link Cache}. | |
70 | * @throws CacheException error when creating the cache. | |
71 | */ | |
72 | <T> Cache<T> createNewLocalCache(CacheConfiguration config) throws CacheException; | |
73 | } |