JCacheOperationSource implementation delegating
default operations to configurable services with sensible defaults
when not present.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | DefaultJCacheOperationSource.
Only resolve the default exception cache resolver when an exception needs to be handled. |
| Modifier and Type | Field and Description |
|---|---|
| private final SingletonSupplier | |
| private BeanFactory | |
| private SingletonSupplier | |
| private SingletonSupplier | |
| private SingletonSupplier | |
| private SingletonSupplier |
| Access | Constructor and Description |
|---|---|
| public | DefaultJCacheOperationSource()
Construct a new |
| public | DefaultJCacheOperationSource(Supplier<CacheManager> cacheManager, Supplier<CacheResolver> cacheResolver, Supplier<CacheResolver> exceptionCacheResolver, Supplier<KeyGenerator> keyGenerator)
Construct a new |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterSingletonsInstantiated()
Implements org. Invoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already. |
| protected <T> T | getBean(Class<T>
the type of the bean to manage type)Implements abstract org. Locate or create an instance of the specified cache strategy |
| public CacheManager | |
| public CacheResolver | |
| protected CacheManager | |
| protected CacheResolver | getDefaultCacheResolver()
Implements abstract org. Return the default |
| protected CacheResolver | getDefaultExceptionCacheResolver()
Implements abstract org. Return the default exception |
| protected KeyGenerator | getDefaultKeyGenerator()
Implements abstract org. Return the default |
| public CacheResolver | |
| public KeyGenerator | |
| public void | setBeanFactory(BeanFactory
owning BeanFactory (never beanFactory)null).
The bean can immediately call methods on the factory.Implements org. Callback that supplies the owning factory to a bean instance. |
| public void | setCacheManager(CacheManager cacheManager)
Set the default |
| public void | |
| public void | setExceptionCacheResolver(CacheResolver exceptionCacheResolver)
Set the |
| public void |
| adaptedKeyGenerator | back to summary |
|---|---|
| private final SingletonSupplier<KeyGenerator> adaptedKeyGenerator | |
| beanFactory | back to summary |
|---|---|
| private BeanFactory beanFactory
| |
| cacheManager | back to summary |
|---|---|
| private SingletonSupplier<CacheManager> cacheManager
| |
| cacheResolver | back to summary |
|---|---|
| private SingletonSupplier<CacheResolver> cacheResolver
| |
| exceptionCacheResolver | back to summary |
|---|---|
| private SingletonSupplier<CacheResolver> exceptionCacheResolver
| |
| keyGenerator | back to summary |
|---|---|
| private SingletonSupplier<KeyGenerator> keyGenerator | |
| DefaultJCacheOperationSource | back to summary |
|---|---|
| public DefaultJCacheOperationSource() Construct a new
| |
| DefaultJCacheOperationSource | back to summary |
|---|---|
| public DefaultJCacheOperationSource(Supplier<CacheManager> cacheManager, Supplier<CacheResolver> cacheResolver, Supplier<CacheResolver> exceptionCacheResolver, Supplier<KeyGenerator> keyGenerator) Construct a new
| |
| afterSingletonsInstantiated | back to summary |
|---|---|
| public void afterSingletonsInstantiated() Implements org. Doc from org. Invoked right at the end of the singleton pre-instantiation phase,
with a guarantee that all regular singleton beans have been created
already. Note This callback won't be triggered for singleton beans
lazily initialized on demand after
| |
| getBean | back to summary |
|---|---|
| protected <T> T getBean(Class<T> type) Implements abstract org. Doc from org. Locate or create an instance of the specified cache strategy | |
| getCacheManager | back to summary |
|---|---|
| public CacheManager getCacheManager() Return the specified cache manager to use, if any.
| |
| getCacheResolver | back to summary |
|---|---|
| public CacheResolver getCacheResolver() Return the specified cache resolver to use, if any.
| |
| getDefaultCacheManager | back to summary |
|---|---|
| protected CacheManager getDefaultCacheManager() | |
| getDefaultCacheResolver | back to summary |
|---|---|
| protected CacheResolver getDefaultCacheResolver() Implements abstract org. Doc from org. Return the default
| |
| getDefaultExceptionCacheResolver | back to summary |
|---|---|
| protected CacheResolver getDefaultExceptionCacheResolver() Implements abstract org. Return the default exception
| |
| getDefaultKeyGenerator | back to summary |
|---|---|
| protected KeyGenerator getDefaultKeyGenerator() Implements abstract org. Doc from org. Return the default
| |
| getExceptionCacheResolver | back to summary |
|---|---|
| public CacheResolver getExceptionCacheResolver() Return the specified exception cache resolver to use, if any.
| |
| getKeyGenerator | back to summary |
|---|---|
| public KeyGenerator getKeyGenerator() Return the specified key generator to use. | |
| setBeanFactory | back to summary |
|---|---|
| public void setBeanFactory(BeanFactory beanFactory) Implements org. Doc from org. Callback that supplies the owning factory to a bean instance. Invoked after the population of normal bean properties
but before an initialization callback such as
| |
| setCacheManager | back to summary |
|---|---|
| public void setCacheManager(CacheManager cacheManager) Set the default | |
| setCacheResolver | back to summary |
|---|---|
| public void setCacheResolver(CacheResolver cacheResolver) Set the | |
| setExceptionCacheResolver | back to summary |
|---|---|
| public void setExceptionCacheResolver(CacheResolver exceptionCacheResolver) Set the | |
| setKeyGenerator | back to summary |
|---|---|
| public void setKeyGenerator(KeyGenerator keyGenerator) Set the default | |
A non-JSR-107 setup requires either a CacheManager or a CacheResolver.
If only the latter is specified, it is not possible to extract a default exception
CacheResolver from a custom CacheResolver implementation, so we have to
fall back on the CacheManager.
This gives this weird situation of a perfectly valid configuration that breaks all
of a sudden because the JCache support is enabled. To avoid this we resolve the default
exception CacheResolver as late as possible to avoid such hard requirement
in other cases.
| Modifier and Type | Field and Description |
|---|---|
| private final SingletonSupplier |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Collection | resolveCaches(CacheOperationInvocationContext<?>
the context of the particular invocation context)Implements org. Return the cache(s) to use for the specified invocation. |
| cacheResolver | back to summary |
|---|---|
| private final SingletonSupplier<CacheResolver> cacheResolver | |
| LazyCacheResolver | back to summary |
|---|---|
| pack-priv LazyCacheResolver() | |
| resolveCaches | back to summary |
|---|---|
| public Collection Implements org. Doc from org. Return the cache(s) to use for the specified invocation.
| |