title: Spring @Cacheable methods with lists
body: <p>I'm using latest Ehcache in my Spring 4.1.4 application. What I have is:</p>
  
     <pre class="lang-java prettyprint-override"><code>class Contact{
      int id;
      int revision;
  }    
  
  @Cacheable("contacts")
  public List&lt;Contact&gt; getContactList(List&lt;Integer&gt; contactIdList) {
      return namedJdbc.queryForList("select * from contact where id in (:idlist)", Collections.singletonMap("idlist", contactIdList));
  }
  
  @CachePut(value="contact", key = "id")
  public void updateContact(Contact toUpdate) {
      jdbctemplate.update("update contact set revision = ? where id = ?", contact.getRevision(), contact.getId());
  }
  </code></pre>
  
  <p>What I want to achieve is, that contacts are stored in the cache, and when I'm calling the <code>getContactList</code> method again, that all contacts whose <code>id</code> is already cached are retrieved from the cache and the other ones should be queried normally and then cached. This cache should then update the cached contact entity when it is updated.</p>
  
  <p>I'm using plain Spring JDBC and Ehcache, no JPA and no Hibernate.</p>