title: configure object level caching in ehcache
body: <p>Is there any way to configure object or class level caching (each one with different settings) in ehcache? I am using java+spring+mybatis stack.</p>
  
  <p>Also, what would be the ehcache equivalent of following oscache based implementation?</p>
  
  <pre><code>public Map&lt;Integer, ProductDetails&gt; getProductDetails(final List&lt;Integer&gt; productIds)
  throws Exception{
      Map&lt;Integer, ProductDetails&gt; result = null;
  
      try{
          //Get from cache.
          result = (Map&lt;Integer, ProductDetails&gt;) cache.getFromCache("AllProductDetails");
  
          if(result == null){
              throw new NeedsRefreshException("Cache needs a refresh!");
          }
      }
      catch(final NeedsRefreshException nre){
          try{
              result = ProductDetailsDao.getProductDetails("");
              cache.putInCache("AllProductDetails", result);
          }
          catch (final Exception e){
              result = (Map&lt;Integer, ProductDetails&gt;) nre.getCacheContent();
              cache.cancelUpdate("AllProductDetails");
          }
      }
      return result;
  }
  </code></pre>
  
  <p>I see that there is no equivalent of com.opensymphony.oscache.base.NeedsRefreshException in ehcache.</p>
  
  <p>What is the recommended way to identify if data for particular object has been expired or if the object is not present in cache at all?</p>