@@ -435,6 +435,11 @@ private Cache.ValueWrapper findCachedItem(Collection<CacheOperationContext> cont
435
435
if (cached != null ) {
436
436
return cached ;
437
437
}
438
+ else {
439
+ if (logger .isTraceEnabled ()) {
440
+ logger .trace ("No cache entry for key '" + key + "' in cache(s) " + context .getCacheNames ());
441
+ }
442
+ }
438
443
}
439
444
}
440
445
return null ;
@@ -462,6 +467,9 @@ private Cache.ValueWrapper findInCaches(CacheOperationContext context, Object ke
462
467
for (Cache cache : context .getCaches ()) {
463
468
Cache .ValueWrapper wrapper = doGet (cache , key );
464
469
if (wrapper != null ) {
470
+ if (logger .isTraceEnabled ()) {
471
+ logger .trace ("Cache entry for key '" + key + "' found in cache '" + cache .getName () + "'" );
472
+ }
465
473
return wrapper ;
466
474
}
467
475
}
@@ -484,7 +492,7 @@ private Object generateKey(CacheOperationContext context, Object result) {
484
492
"using named params on classes without debug info?) " + context .metadata .operation );
485
493
}
486
494
if (logger .isTraceEnabled ()) {
487
- logger .trace ("Computed cache key " + key + " for operation " + context .metadata .operation );
495
+ logger .trace ("Computed cache key ' " + key + "' for operation " + context .metadata .operation );
488
496
}
489
497
return key ;
490
498
}
@@ -548,13 +556,16 @@ protected class CacheOperationContext implements CacheOperationInvocationContext
548
556
549
557
private final Collection <? extends Cache > caches ;
550
558
559
+ private final Collection <String > cacheNames ;
560
+
551
561
private final AnnotatedElementKey methodCacheKey ;
552
562
553
563
public CacheOperationContext (CacheOperationMetadata metadata , Object [] args , Object target ) {
554
564
this .metadata = metadata ;
555
565
this .args = extractArgs (metadata .method , args );
556
566
this .target = target ;
557
567
this .caches = CacheAspectSupport .this .getCaches (this , metadata .cacheResolver );
568
+ this .cacheNames = createCacheNames (this .caches );
558
569
this .methodCacheKey = new AnnotatedElementKey (metadata .method , metadata .targetClass );
559
570
}
560
571
@@ -633,6 +644,18 @@ private EvaluationContext createEvaluationContext(Object result) {
633
644
protected Collection <? extends Cache > getCaches () {
634
645
return this .caches ;
635
646
}
647
+
648
+ protected Collection <String > getCacheNames () {
649
+ return this .cacheNames ;
650
+ }
651
+
652
+ private Collection <String > createCacheNames (Collection <? extends Cache > caches ) {
653
+ Collection <String > names = new ArrayList <String >();
654
+ for (Cache cache : caches ) {
655
+ names .add (cache .getName ());
656
+ }
657
+ return names ;
658
+ }
636
659
}
637
660
638
661
0 commit comments