1 package org.oxerr.spring.cache.redis.scored.example.helloworld; 2 3 import org.springframework.cache.annotation.CachePut; 4 import org.springframework.cache.annotation.Cacheable; 5 import org.springframework.data.repository.CrudRepository; 6 import org.springframework.stereotype.Repository; 7 8 @Repository 9 public interface BookRepository extends CrudRepository<Book, String> { 10 11 @Cacheable("books") 12 Book getByIsbn(String isbn); 13 14 @Override 15 @CachePut(value = "books", key = "#result.isbn") 16 <S extends Book> S save(S entity); 17 18 }