com.googlecode.ehcache.annotations
Annotation Type Cacheable


@Target(value=METHOD)
@Retention(value=RUNTIME)
@Inherited
@Documented
public @interface Cacheable

Annotation for methods whose return values should be cached.


Required Element Summary
 java.lang.String cacheName
          The name of the cache to use
 
Optional Element Summary
 java.lang.String cacheableInteceptorName
          The Spring Bean name of the CacheableInterceptor to use when intercepting invocations.
 boolean cacheNull
          If true null return values will be cached.
 DecoratedCacheType decoratedCacheType
          The type of cache decoration to use.
 java.lang.String exceptionCacheName
          The name of the cache to use for storing exceptions thrown by the advised method.
 KeyGenerator keyGenerator
          Used the specify and configure the CacheKeyGenerator to use.
 java.lang.String keyGeneratorName
          The Spring Bean name of the CacheKeyGenerator to use.
 long refreshInterval
          Sets the time in ms between cache refreshes.
 ResolverFactory resolverFactory
          Used the specify and configure the CacheResolverFactory to use.
 java.lang.String resolverFactoryName
          The Spring Bean name of the CacheResolverFactory to use to resolve the correct cache at runtime.
 boolean selfPopulating
          Deprecated. use decoratedCacheType(). Ignored if decoratedCacheType() is set to anything other than NONE
 int selfPopulatingTimeout
          Sets the time in ms to wait to acquire a lock.
 

Element Detail

cacheName

public abstract java.lang.String cacheName
The name of the cache to use

cacheNull

public abstract boolean cacheNull
If true null return values will be cached. If false they will not. Defaults to true. NOTE that if decoratedCacheType() is set to DecoratedCacheType.SELF_POPULATING_CACHE or DecoratedCacheType.REFRESHING_SELF_POPULATING_CACHE this setting is assumed to be true.

Default:
true

decoratedCacheType

public abstract DecoratedCacheType decoratedCacheType
The type of cache decoration to use. Defaults to DecoratedCacheType.NONE.

Default:
com.googlecode.ehcache.annotations.DecoratedCacheType.NONE

selfPopulating

@Deprecated
public abstract boolean selfPopulating
Deprecated. use decoratedCacheType(). Ignored if decoratedCacheType() is set to anything other than NONE

If a EhCache SelfPopulatingCache wrapper should be used to ensure only one value per key is created.

Default:
false

selfPopulatingTimeout

public abstract int selfPopulatingTimeout
Sets the time in ms to wait to acquire a lock. Only used if decoratedCacheType() is set to DecoratedCacheType.SELF_POPULATING_CACHE or DecoratedCacheType.REFRESHING_SELF_POPULATING_CACHE. Must be greater than or equal to 0. A value of 0 means wait forever, any positive value means wait for that many milliseconds before throwing a LockTimeoutException

See Also:
BlockingCache.setTimeoutMillis(int)
Default:
0

refreshInterval

public abstract long refreshInterval
Sets the time in ms between cache refreshes. Only used if decoratedCacheType() is set to DecoratedCacheType.REFRESHING_SELF_POPULATING_CACHE. Defaults to 1 minute. Must be greater than 0.

See Also:
RefreshingSelfPopulatingCache#setRefreshInterval(long)
Default:
60000L

keyGeneratorName

public abstract java.lang.String keyGeneratorName
The Spring Bean name of the CacheKeyGenerator to use. Ignored if keyGenerator() is specified. If this and keyGenerator() are not specified the default generator will be used.

Default:
""

exceptionCacheName

public abstract java.lang.String exceptionCacheName
The name of the cache to use for storing exceptions thrown by the advised method. If not specified exceptions will result in no caching taking place.

Default:
""

keyGenerator

public abstract KeyGenerator keyGenerator
Used the specify and configure the CacheKeyGenerator to use. If this and keyGeneratorName() are not specified the default generator will be used.

Default:
@com.googlecode.ehcache.annotations.KeyGenerator(name="")

cacheableInteceptorName

public abstract java.lang.String cacheableInteceptorName
The Spring Bean name of the CacheableInterceptor to use when intercepting invocations.

Default:
""

resolverFactoryName

public abstract java.lang.String resolverFactoryName
The Spring Bean name of the CacheResolverFactory to use to resolve the correct cache at runtime. Ignored if resolverFactory() is specified. If this and resolverFactory() are not specified the specified cacheName() will be used.

Default:
""

resolverFactory

public abstract ResolverFactory resolverFactory
Used the specify and configure the CacheResolverFactory to use. If this and resolverFactoryName() are not specified the specified cacheName() will be used.

Default:
@com.googlecode.ehcache.annotations.ResolverFactory(name="")


Copyright © 2011. All Rights Reserved.