Using Spring Cache with HystrixCommand is not working

22 Views Asked by At

Using Spring Cache with HystrixCommand is not working as if the @Cacheable is not there. no logs about caching by debuging. the Method will always called.

here is the code:

@Override
@Cacheable(value = "somecachename",
      cacheManager = "cacheManager",
      key = "#accountNumber",
      condition = "#result?.list.size() > 0")
public Stuff getResults(
      final String accountNumber){

//code to cache
}



@Override
@HystrixCommand
public Future< Stuff > retrieveReultsAsynchronously(
      final String accountNumber) {
   return new AsyncResult< Stuff >() {
      @Override
      public Stuff invoke() {
         return getResults (accountNumber);
      }
   };
}

results conditionally to be cached and see logs

0

There are 0 best solutions below