public class SpringCacheTransformer extends Object implements org.apache.commons.collections.Transformer, org.springframework.beans.factory.BeanNameAware
CacheManager
to fetch data from a Cache. The cache key name can be derived from the input to the Transformer
or even using the BeanNameAware
for the instance. One can override #getCacheKeyName()
to override the algorithm to derive the key.#accessorTransformer
Constructor and Description |
---|
SpringCacheTransformer() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
fetchFreshContent(org.springframework.cache.Cache.ValueWrapper vw)
When should one attempt a fetch.
|
org.apache.commons.collections.Transformer |
getCacheKeyAccessorTransformer()
If Not null, will assume input not to be an array and will assign the cache key to be the name derived from this transformer.
|
String |
getCacheKeyName(Object input) |
org.springframework.cache.CacheManager |
getCacheManager() |
String |
getCacheName() |
org.apache.commons.collections.Transformer |
getTransformer()
The Transformer that will take the input and get the results if no cache or result is available for the requested key defined by
#getCacheKeyName() |
void |
setBeanName(String beanName) |
void |
setCacheKeyAccessorTransformer(org.apache.commons.collections.Transformer cacheKeyAccessorTransformer)
If Not null, will assume input not to be an array and will assign the cache key to be the name derived from this transformer.
|
void |
setCacheManager(org.springframework.cache.CacheManager cacheManager) |
void |
setCacheName(String cacheName) |
void |
setTransformer(org.apache.commons.collections.Transformer transformer)
The Transformer that will take the input and get the results if no cache or result is available for the requested key defined by
#getCacheKeyName() |
Object |
transform(Object input)
The input represents the parameters to the Query; as Object[] array
|
@Transactional public Object transform(Object input)
transform
in interface org.apache.commons.collections.Transformer
input
- as Object[] @nullable trueprotected boolean fetchFreshContent(org.springframework.cache.Cache.ValueWrapper vw)
public void setBeanName(String beanName)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public org.springframework.cache.CacheManager getCacheManager()
public void setCacheManager(org.springframework.cache.CacheManager cacheManager)
public String getCacheName()
public void setCacheName(String cacheName)
public org.apache.commons.collections.Transformer getTransformer()
#getCacheKeyName()
public void setTransformer(org.apache.commons.collections.Transformer transformer)
#getCacheKeyName()
public org.apache.commons.collections.Transformer getCacheKeyAccessorTransformer()
public void setCacheKeyAccessorTransformer(org.apache.commons.collections.Transformer cacheKeyAccessorTransformer)
Copyright © 2018. All rights reserved.