spring boot starter数据redis可缓存(sync=true)不工作?

spring boot starter数据redis可缓存(sync=true)不工作?,spring,spring-boot,spring-data-redis,Spring,Spring Boot,Spring Data Redis,我想使用Cacheable(sync=true)来控制访问方法的并发行为 @Service @CacheConfig(cacheNames = "book") public class BookService { @Cacheable(key = "#isbn",sync = true) public Book book(String isbn,int id) { System.out.println("wait 3s..."); try { Thread.sl

我想使用Cacheable(sync=true)来控制访问方法的并发行为

@Service
@CacheConfig(cacheNames = "book")
public class BookService {

@Cacheable(key = "#isbn",sync = true)
public Book book(String isbn,int id) {
    System.out.println("wait 3s...");
    try {
        Thread.sleep(3000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return new Book(isbn, "xxxx");
  }

}
编写一个测试用例:

ExecutorService executorService = Executors.newFixedThreadPool(10);
    for (int i = 0; i < 100; i++) {
        final int index = i;
        executorService.execute(new Runnable() {
            @Override
            public void run() {
                bookService.book("1100011", index);
            }
        });
    }
这样使用redis缓存是错误的吗

wait 3s...
wait 3s...
wait 3s...
wait 3s...
wait 3s...