Package org.linuxforhealth.fhir.cache
Class CachingProxy
- java.lang.Object
-
- org.linuxforhealth.fhir.cache.CachingProxy
-
public final class CachingProxy extends java.lang.Object
A Java dynamic proxy that caches method results based on the presence of a @Cacheable annotation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CachingProxy.KeyGenerator
An interface for generating cache keys used by the caching invocation handler to cache method results
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
hasCacheableMethod(java.lang.Class<?> targetClass)
Indicates whether the provided class has at least one method with the @Cacheable annotationstatic <T> T
newInstance(java.lang.Class<T> interfaceClass, T target)
Create a new proxy instance that implements the provided interface and delegates to a caching invocation handler.
-
-
-
Method Detail
-
newInstance
public static <T> T newInstance(java.lang.Class<T> interfaceClass, T target)
Create a new proxy instance that implements the provided interface and delegates to a caching invocation handler.- Type Parameters:
T
- the type of the proxy instance- Parameters:
interfaceClass
- the interface classtarget
- the target- Returns:
- a new proxy instance that implements the provided interface
-
hasCacheableMethod
public static boolean hasCacheableMethod(java.lang.Class<?> targetClass)
Indicates whether the provided class has at least one method with the @Cacheable annotation- Parameters:
targetClass
- the target class- Returns:
- true if the provided class has at least one method with the @Cacheable annotation, false otherwise
-
-