public class MgnlCacheManager extends Object implements javax.cache.CacheManager
CacheFactoryProvider to a CacheManager. This is needed for cache-annotations-ri-guice, but
it can be used more generically for code which desires such a cache manager.| Modifier and Type | Class and Description |
|---|---|
static interface |
MgnlCacheManager.Getter |
| Constructor and Description |
|---|
MgnlCacheManager(info.magnolia.module.cache.inject.CacheFactoryProvider factory,
org.jsr107.ri.annotations.guice.CacheLookupUtil util) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
<K,V,C extends javax.cache.configuration.Configuration<K,V>> |
createCache(String cacheName,
C configuration) |
void |
destroyCache(String cacheName) |
void |
enableManagement(String cacheName,
boolean enabled) |
void |
enableStatistics(String cacheName,
boolean enabled) |
<K,V> javax.cache.Cache<K,V> |
getCache(String cacheName) |
<K,V> javax.cache.Cache<K,V> |
getCache(String cacheName,
Class<K> keyType,
Class<V> valueType) |
Iterable<String> |
getCacheNames() |
javax.cache.spi.CachingProvider |
getCachingProvider() |
ClassLoader |
getClassLoader() |
Iterator<Object[]> |
getKeys(Class<?> clazz,
Object instance,
String methodName,
Class<?>... keys) |
protected Method |
getMethod(Class<?> clazz,
String methodName,
Class<?>... arguments) |
protected org.jsr107.ri.annotations.CacheResultMethodDetails |
getMethodDetails(Class<?> clazz,
String methodName,
Class<?>... keyClasses) |
<K,V> javax.cache.Cache<K,V> |
getUnblockingCache(String cacheName)
Caches in magnolia are always blocking.
|
URI |
getURI() |
Object |
getValue(Class<?> clazz,
Object instance,
String methodName,
Object... key)
Gets a value from the cache (without blocking it).
|
Object |
getValue(String cacheName,
Object key)
Gets a value from the cache (without blocking it)
This method requires that you know exactly what the key is in the underlying cache.
|
MgnlCacheManager.Getter |
getValueGetter(Class<?> clazz,
Object instance,
String methodName,
Class<?>... keyClasses) |
boolean |
isClosed() |
<T> T |
unwrap(Class<T> clazz) |
@Inject
public MgnlCacheManager(info.magnolia.module.cache.inject.CacheFactoryProvider factory,
org.jsr107.ri.annotations.guice.CacheLookupUtil util)
public javax.cache.spi.CachingProvider getCachingProvider()
getCachingProvider in interface javax.cache.CacheManagerpublic URI getURI()
getURI in interface javax.cache.CacheManagerpublic ClassLoader getClassLoader()
getClassLoader in interface javax.cache.CacheManagerpublic <K,V,C extends javax.cache.configuration.Configuration<K,V>> javax.cache.Cache<K,V> createCache(String cacheName, C configuration) throws IllegalArgumentException
createCache in interface javax.cache.CacheManagerIllegalArgumentExceptionpublic <K,V> javax.cache.Cache<K,V> getCache(String cacheName, Class<K> keyType, Class<V> valueType)
getCache in interface javax.cache.CacheManagerpublic <K,V> javax.cache.Cache<K,V> getCache(String cacheName)
getCache in interface javax.cache.CacheManagerpublic <K,V> javax.cache.Cache<K,V> getUnblockingCache(String cacheName)
public Iterable<String> getCacheNames()
getCacheNames in interface javax.cache.CacheManagerpublic void destroyCache(String cacheName)
destroyCache in interface javax.cache.CacheManagerpublic void enableManagement(String cacheName, boolean enabled)
enableManagement in interface javax.cache.CacheManagerpublic void enableStatistics(String cacheName, boolean enabled)
enableStatistics in interface javax.cache.CacheManagerpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in interface javax.cache.CacheManagerpublic boolean isClosed()
isClosed in interface javax.cache.CacheManagerpublic Object getValue(Class<?> clazz, Object instance, String methodName, Object... key)
CacheResult annotation,
and give its key parameters.clazz - The class containing the @CacheResult annotationinstance - The instance on which the cache method will be calledmethodName - The method for which the cache must be usedkey - The arguments of that method that make up the key in the cache (considering the cache key generator and the CacheKey annotations.public MgnlCacheManager.Getter getValueGetter(Class<?> clazz, Object instance, String methodName, Class<?>... keyClasses)
public Iterator<Object[]> getKeys(Class<?> clazz, Object instance, String methodName, Class<?>... keys)
protected org.jsr107.ri.annotations.CacheResultMethodDetails getMethodDetails(Class<?> clazz, String methodName, Class<?>... keyClasses)
public Object getValue(String cacheName, Object key)
getValue(Class, Object, String, Object...) does not have that requirement.public <T> T unwrap(Class<T> clazz)
unwrap in interface javax.cache.CacheManagerCopyright © 2016–2022. All rights reserved.