1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.impl.cache; |
17 | |
|
18 | |
import org.kuali.rice.core.api.cache.CacheManagerRegistry; |
19 | |
import org.springframework.cache.Cache; |
20 | |
import org.springframework.cache.CacheManager; |
21 | |
|
22 | |
import java.util.ArrayList; |
23 | |
import java.util.Collection; |
24 | |
import java.util.Collections; |
25 | |
import java.util.List; |
26 | |
|
27 | 0 | public class GlobalCacheManager implements CacheManager { |
28 | |
|
29 | |
|
30 | |
private CacheManagerRegistry cacheManagerRegistry; |
31 | |
|
32 | |
@Override |
33 | |
public Cache getCache(String name) { |
34 | 0 | return cacheManagerRegistry.getCacheManagerByCacheName(name).getCache(name); |
35 | |
} |
36 | |
|
37 | |
@Override |
38 | |
public Collection<String> getCacheNames() { |
39 | 0 | List<String> cacheNames = new ArrayList<String>(); |
40 | 0 | for (CacheManager cm : cacheManagerRegistry.getCacheManagers()) { |
41 | 0 | cacheNames.addAll(cm.getCacheNames()); |
42 | |
} |
43 | 0 | return Collections.unmodifiableCollection(cacheNames); |
44 | |
} |
45 | |
|
46 | |
public void setCacheManagerRegistry(CacheManagerRegistry cacheManagerRegistry) { |
47 | 0 | this.cacheManagerRegistry = cacheManagerRegistry; |
48 | 0 | } |
49 | |
} |