Plugins You can find out about all the publicly available Grails plugins.

Cache Filter

  • Tags: /
  • Latest: 0.5
  • Last Updated: 21 January 2010
  • Grails version: 1.1 > *
  • Authors: jga
0 vote
compile "org.grails.plugins:cachefilter:0.5"




grails install-plugin cachefilter


This plugin permits to easily use oscache caching filter with grails (

This servlet filter enables you to transparently cache generated html pages (and binary contents) of your grails application. Page caching allows to reduce server loads (by avoiding calls to controllers and gsp pages).

Usage :

declare your filters in conf/Config.groovy :

for example :

cachefilter {
    filters= [
        filterStatic : [
            enabled: true,
            pattern: '/images/*,/css/*'
        filter1 : [

] }

Previous example defines 2 filters, named filterStatic and filter1. Each filter can have distinct parameters.

Parameters :

The parameter enabled permits to deactivate a filter. enabled is true by default.

with the pattern parameter, you define the URL patterns for the filter. This parameter is mandatory. Each Url pattern (url-pattern) is separated by ','.

Others parameters are those defined by CacheFilter (

Some parameters used to tune content caching :

time : the default time (in seconds) to cache content for (default value is 3600 seconds).

scope : the default scope to cache content : application (default), session, request or page.

expires : defines if the Expires http header will be sent : on (default), off or time

lastModified : defines if the Last-Modified http header will be sent . possible values are on, off, initial (default)

cron : cron expression to define when cache will expire (ex : "* * * * Sunday" )