Posted by Jeremy on September 15, 2009 at 11:39pm
Jump to:
| Project: | Memcache API and Integration |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
The goal of the attached patch is to make it possible to control the minimum cache lifetime for your site on a per-path (URL) basis.
With the patch applied, granular page cache lifetimes are configured by adding a pagecache_lifetime array to the $conf array in the format PATH_REGEX => SECONDS. For example:
$conf = array(
'pagecache_lifetime' => array(
'&^http://www\.sample\.com/blogs.*&' => 86400,
'&^http://www\.sample\.com/tracker.*&' => 1800,
'&^http://www\.sample\.com/$&' => 60,
),
);In this example, http://www.sample.com will be cached for 60 seconds. Any page starting with http://www.sample.com/blogs will be cached for 1 day. And any page starting with http://www.sample.com/tracker will be cached for 30 minutes.
Writing path rules:
- order is important: the first match is what is used.
- the patch uses raw regular expressions. "." matches any single character. ".*" matches all characters. "^" signifies the start of the url, and "$" signifies the end.
- if no path rule matches, then the default minimum cache lifetime is used as is set by Drupal's standard admin interface.
- you can completely disable the page cache for paths by specifying a cache_lifetime of 0.
- The minimum cache lifetime is specified in seconds.
| Attachment | Size |
|---|---|
| memcache.inc_.patch | 1016 bytes |
Comments
#1
bumping to 7.x. This would be handy, would be good to possibly merge with the per-bin code from #186638: Add a 'keep until' column for cache tables as well.