Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails ehcache plugin cache not expiring

With the Grails ehcache plugin I'm trying to cache a response and occasionally refresh that response.

This is what I have in my Config.groovy,

grails.cache.config = {
    cache {
        name 'winners'
        eternal false
        timeToLiveSeconds 10
    }
}

And I annotating the winners endpoint with @Cacheable('winners').

I am seeing the response get cached, but I am never seeing the cache expire. Anyone have any clue what might be going on here?

like image 834
James McMahon Avatar asked Mar 02 '26 00:03

James McMahon


1 Answers

I had the same problem.

Adding ehcache.xml file into the config directory seemed to fix it.

See http://ehcache.org/documentation/integrations/grails for details.

Btw, I had to replace the attributes 'maxEntriesLocalHeap' with 'maxElementsInMemory'.

like image 179
Jaanus Avatar answered Mar 03 '26 12:03

Jaanus