title: ehcache session scoped in grails
body: <p>I want to user in a grails service a ehcache session scoped.</p>
  
  <p>I managed to have a cache bean from this definition in config/resources.groovy</p>
  
  <pre><code>myCache(org.springframework.cache.ehcache.EhCacheFactoryBean) {
        timeToIdle = 5000 // life span in seconds
        timeToLive = 5000 // life span in seconds
        }
  </code></pre>
  
  <p>But the object obtained from the factory is singleton scoped.</p>
  
  <p>What is the best way to have a session scoped ehcache in a session scoped service?</p>
  
  <p>Thank you</p>