We were talking last night at our Drupal meetup about some extreme optimizations and I had a great idea--would it be possible to use this module to generate *certain* file paths to turn into a file for caching--e.g., not everything, to prevent millions of HTML files per chance?
Often when a site is Dugg, only the homepage needs to turn into a HTML file and the others can be ok.
If there was a "visibility" like setting, much like block visibility:
- cache all pages except the following
- cache nothing but the following
- cache only if this PHP is true
Could be a really powerful feature in that sense... This should presumably only run at cron time so it doesn't have to do this processing for each request.
Comments
Comment #1
jeremy commentedThis is certainly doable. You'd just need to update the logic that writes the cache pages, and make it to only cache the ones that match your regex. I imagine the GUI could be the same as that used by setting paths for blocks.
Comment #2
moshe weitzman commentedsure ... you might lok at the path optimization patch for whitelist and blacklist and other ideas - http://drupal.org/node/106559
Comment #3
jeremy commentedI've run into a bigger problem -- I think Drupal's only capable of having one cache type. So, if we only file-cache specific pages and not others, those other pages won't be cached at all. Obviously that's suboptimal (to the point of being useless imho).
Comment #4
jeremy commentedOne idea on how to implement this is to add a new include file, and then changing the line in $conf array in settings.php to point to the new file. ie, changing:
To be something like:
Then the actual file_access logic would be moved into the new
cache_select.incfile, while actual cache logic would stay in the oldcache_fs.inc. In the first access to that file, we'd load the variables array from the file cache to retrieve the array of paths determining whether or not a page is cached. Then, compare the current URI against the array of paths. If matching a file cache, load cache_fs.inc and proceed. If not, load the core cache.inc and proceed.Comment #5
moshe weitzman commentedthat would be reasonable.
Comment #6
chx commentedNote that URL aliasing might be a problem. Database is not yet there.
Comment #7
jeremy commentedThe url_alias table could be cached easily enough in a serialized array. This could be more problematic for sites with very large numbers of aliases.
Alternatively, the administrative interface could spell out the fact that administrators are responsible for including rules for all possible paths to content they wish to file cache, aliased and not.
Comment #8
kenorb commentedClosed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.