org.onebusaway.container.cache
Annotation Type Cacheable


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

A method annotation that indicates that the results method are cacheable, using the arguments to the method as the cache key. Method calls are intercepted using an Aspect-oriented interceptor, as implemented in CacheableAnnotationInterceptor. The bulk of the caching mechanism is provided by CacheableMethodManager, which handles the actual task of generating a cache key for a particular method call, determining if a cached results exists, and generating a fresh result as needed by completing the underlying method call. EhCache is used as the default caching mechanism. Unless otherwise specified with #name(), each method cache name takes the form of "package.SomeClass.methodName". Use standard EhCache configuration to provide specific cache behavior for a particular cached method call. The keyFactory() method allows an extension mechanism to define a CacheableMethodKeyFactory that determines how the arguments to a particular method will be used to generate a cache key. By default, the DefaultCacheableKeyFactory factory is used, which simply uses DefaultCacheableObjectKeyFactory factories to generate a key for each argument, unless otherwise specified with a CacheableKey annotation.

Author:
bdferris
See Also:
CacheableAnnotationInterceptor, CacheableMethodKeyFactory, CacheableMethodManager

Optional Element Summary
 boolean isValueSerializable
           
 Class<? extends CacheableMethodKeyFactory> keyFactory
           
 

keyFactory

public abstract Class<? extends CacheableMethodKeyFactory> keyFactory
Returns:
a factory class for creating cache keys from method arguments
Default:
org.onebusaway.container.cache.CacheableMethodKeyFactory.class

isValueSerializable

public abstract boolean isValueSerializable
Default:
true


Copyright © 2012 OneBusAway. All Rights Reserved.