This patch provides an API to support multiple cache directories. If no module implements one of the hooks, boost will fall back to the current mechanism, i.e. the normal cache directory.

The patch introduces the following hooks:

  1. hook_boost_cache_variant(): Return an array describing cache variants where keys are variant names and values are arrays containing the following elements (currently only dir): dir: The name of the cache directory for this variant.
  2. hook_boost_cache_variant_alter(&$variants): Let third party modules modify the variants array.
  3. boost_active_cache_variant(&$name): Let third party modules choose the cache variant which should be active for the current request.

Beside the new hooks, the patch also modifies the following functions in order to make them work with multiple cache directories:

  • boost_requirements
  • boost_cron
  • boost_flush_caches
  • boost_transform_url
  • boost_htaccess_cache_dir_put

This patch also is a result of the ongoing integration work announced in #1932444: Boost as Authcache Backend. However it also should help with #629520: Cache by theme for mobile sites..

Comments very welcome.

Comments

znerol’s picture

Status: Active » Needs review
jason.fisher’s picture

With latest dev:

patching file boost.install
patching file boost.module
Hunk #4 FAILED at 389.
Hunk #5 succeeded at 438 (offset 7 lines).
Hunk #6 succeeded at 452 (offset 7 lines).
Hunk #7 succeeded at 463 (offset 7 lines).
Hunk #8 succeeded at 498 (offset 7 lines).
Hunk #9 succeeded at 1530 (offset 7 lines).
1 out of 9 hunks FAILED -- saving rejects to file boost.module.rej
marcelovani’s picture

Issue summary: View changes
Status: Needs review » Needs work

I tried the patch but it doesn't apply

socialnicheguru’s picture

after applying the patch will I be able to hook boost into different backends like memcache for example?
Can you explain what 'multiple cache directories' mean and why it is important to boost?

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new10.16 KB

I need to use this patch, so I re-rolled to make it apply on current dev branch.
I did not test it thoroughly and I don't know if the patch works, but I will do some tests as soon as I can and add comments here.
Just one change on previous patch:

+++ b/boost.module
@@ -382,28 +389,31 @@ function boost_flush_caches() {
+      if (strpos($base_root, $url) == 0) {

I believe the order of the parameters was wrong here and I changed.

+++ b/boost.module
@@ -382,28 +389,31 @@ function boost_flush_caches() {
+    // base_root: http://www.example.org
+    // url: http://www.example.org/node/123
+    if (strpos($url, $base_root) === 0) {

Needs reviewing