Sign in to edit and +1 items.
Login required
Download

Cache Filter

(0)
Author(s) jga
Current Release 0.5   (2 years ago)
Grails Version 1.1 > *
Tags
Dependency
compile ":cachefilter:0.5"
Last updated by admin 2 years ago
grails install-plugin cachefilter
Last updated by jga974 2 years ago
This plugin permits to easily use oscache caching filter with grails (http://www.opensymphony.com/oscache/wiki/CacheFilter.html)

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,
            scope:'application',
            time:3600,
            expires:'time',
            pattern: '/images/*,/css/*'
        ],
        filter1 : [
            enabled:true,
            scope:'application',
            time:120,
            pattern:'/book/list'
        ]

] }

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 (http://www.opensymphony.com/oscache/wiki/CacheFilter.html).

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" )

Last updated by admin 2 years ago
Last updated by admin 2 years ago