List of usage examples for org.springframework.cache.interceptor KeyGenerator generate
Object generate(Object target, Method method, Object... params);
From source file:springfox.documentation.spring.web.caching.CachingAspect.java
@Around("(operationRead() || propertiesFor()) && @annotation(cacheable)") public Object operationsAndProperties(ProceedingJoinPoint joinPoint, Cacheable cacheable) throws Throwable { Method method = ((MethodSignature) joinPoint.getSignature()).getMethod(); KeyGenerator keyGenerator = cacheable.keyGenerator().newInstance(); Object key = keyGenerator.generate(joinPoint.getTarget(), method, joinPoint.getArgs()); LOG.info("Caching aspect applied for cache {} with key {}", cacheable.value(), key); return cachedValue(joinPoint, cacheable.value(), key); }
From source file:springfox.documentation.spring.web.caching.CachingAspect.java
@Around("(model() || dependenciesFor()) && @annotation(cacheable)") public Object modelsAndDependencies(ProceedingJoinPoint joinPoint, Cacheable cacheable) throws Throwable { Method method = ((MethodSignature) joinPoint.getSignature()).getMethod(); KeyGenerator keyGenerator = cacheable.keyGenerator().getDeclaredConstructor(TypeResolver.class) .newInstance(typeResolver);/*from w w w .ja va2s . co m*/ Object key = keyGenerator.generate(joinPoint.getTarget(), method, joinPoint.getArgs()); LOG.info("Caching aspect applied for cache {} with key {}", cacheable.value(), key); return cachedValue(joinPoint, cacheable.value(), key); }