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

jeremy’s picture

Category: task » feature

This 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.

moshe weitzman’s picture

sure ... you might lok at the path optimization patch for whitelist and blacklist and other ideas - http://drupal.org/node/106559

jeremy’s picture

I'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).

jeremy’s picture

One 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:

  'cache_inc' => 'modules/fastpath_fscache/cache.fs.inc',

To be something like:

  'cache_inc' => 'modules/fastpath_fscache/cache_select.inc',

Then the actual file_access logic would be moved into the new cache_select.inc file, while actual cache logic would stay in the old cache_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.

moshe weitzman’s picture

that would be reasonable.

chx’s picture

Note that URL aliasing might be a problem. Database is not yet there.

jeremy’s picture

The 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.

kenorb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.