The module allows setting different expiry times for boost cached pages. Using this module you can set different expiry times for different pages in the site based on different rules. The module allows developers to add custom rules of their own as well.

Currently Supported Rules

  • Node age based cache expire rule
    This would allow for older nodes to have an longer cache lifetime. For example setting a cache lifetime of 1 week for nodes older than 1 month and setting a cache lifetime of 1 hour for nodes fresher than 1 week.
  • Node type based cache expire rule
    Different content types can be configured to have different cache lifetimes. For example setting a cache lifetime of 1 week for page nodes and setting a cache lifetime of 1 hour for story nodes.
  • Drupal path / URL based cache expire rule
    This would allow for faster changing URLs like the home page or taxonomy listing pages to have shorter cache lifetimes while slower changing URLs could continue to have longer cache lifetimes.

Sample Configuration

{"name": "nodetype", "expire": 3000000, "type": "page"}
{"name": "nodeage", "expire": 700000, "to": 3000000}
{"name": "nodeage", "expire": 100000, "from": 3000000, "to": 700000}
{"name": "nodeage", "expire": 14400, "from": 700000, "to": 100000}
{"name": "nodeage", "expire": 3600, "from": 100000}
{"name": "path", "expire": 3600, "path": "taxonomy/term/*"}
{"name": "path", "expire": 3600, "path": "blog"}
{"name": "path", "expire": 1200, "path": "<front>"}

The above configuration does the following (after approximating 100000 as the number of seconds in a day)

  • Caches page content type for 30 days
  • Caches other content types based on the age of the node
  • Caches nodes older than 30 days for a week
  • Caches nodes older than 7 days but newer than 30 days for 1 day
  • Caches nodes older than 1 day but newer than 7 days to 4 hours
  • Caches nodes newer than a day to 1 hour
  • Caches taxonomy/term pages for 1 hour
  • Caches blog page for 1 hour
  • Caches front page for 20 minutes

Setting cron to clear expired pages

For the cache expiry times to work correctly there should be a cron job set with a time interval lower than the lowest expiry time you are setting using the rules. There would still be a variation of up to cron_interval in the expiry times. Note that this is how boost cache flushing works in general.

Project Information

Downloads