Created
          November 21, 2013 14:16 
        
      - 
      
 - 
        
Save finnjohnsen/7582236 to your computer and use it in GitHub Desktop.  
    demonstrates fetching TTL values from EhCache using Grails Console Plugin
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import grails.plugin.cache.ehcache.GrailsEhcacheCache; | |
| import net.sf.ehcache.Ehcache; | |
| import net.sf.ehcache.Element; | |
| import org.joda.time.* | |
| GrailsEhcacheCache gC = ctx.grailsCacheManager.getCache('customerAdvisors') | |
| Ehcache nC = gC.getNativeCache() | |
| Element e = nC.get(0) //0 is the key if the method has no parameters. | |
| println new DateTime(new Date(e.getExpirationTime())) | |
| println new DateTime(new Date(e.getCreationTime())) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment