title: EhCache Spring optimization
body: <p>I'm using EhCache(2.10.1) and Spring (4.2.5)</p>
  
  <p>I configured my BookDao's methods with cache like this:</p>
  
  <pre><code>@Cacheable(value = "bookByName", key = "#name")
  public Book findByName(String name) {
      //find book by name in db 
  }
  
  @Cacheable(value = "bookById", key = "#id")
  public Book findById(int id) {
      //find book by id in db
  }
  
  @Cacheable(value = "books", key = "??")
  public List&lt;Book&gt; findAll() {
      //find books in db
  }
  </code></pre>
  
  <p>First, would it be possible to combine <code>findAll</code> cache with <code>findById</code> cache or <code>findByName</code> cache? What should I put in the <code>key annotation parameter</code> to do so?</p>
  
  <p>Second, if I want to update or create one book I need to add/evict this book on each cache and evict the entire list of the <code>findAll</code> method. Is there another way to do this better?  </p>