Hello,

I want to use this useful module to cache pages with APC (with cacherouter) but I have a problem.
Firstly I've tried this following code to test this module to cache all node pages.

function my_module_menu_alter(&$items) {
$items['node/%']['cache'] = MENU_CALLBACK_CACHE_PER_USER;
}

After that all my nodes are unaccessible, I have always an access denied message when I try to access directly a node, even if I'm logged with the admin account.

Cyril.

Comments

pifantastic’s picture

Hi Cyril,

You're correct, I can reproduce your problem. The following change to your code should get it working for you:


function my_module_menu_alter(&$items) {
  $items['node/%node']['cache'] = MENU_CALLBACK_CACHE_PER_USER;
}

In the meantime, I will investigate why your original approach is causing access denied errors.

pifantastic’s picture

Assigned: Unassigned » pifantastic
Status: Active » Closed (works as designed)

Ah, I believe I understand the original problem. There isn't actually a menu definition for the path "node/%' (or at least there isn't any in node.module). So in your code example, you were actually creating a menu item that looked like this:


function my_module_menu() {
  $items['node/%'] = array(
    'cache' => MENU_CALLBACK_CACHE_PER_USER,
  );
  return $items;
}

And since this menu item has no access callback, it was defaulting to access denied.