Skip to content

Instantly share code, notes, and snippets.

@finnjohnsen
Created November 21, 2013 14:16
Show Gist options
  • Save finnjohnsen/7582236 to your computer and use it in GitHub Desktop.
Save finnjohnsen/7582236 to your computer and use it in GitHub Desktop.
demonstrates fetching TTL values from EhCache using Grails Console Plugin
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