My drupal installation has this "structure":

- alias for nodes of type "canto" are like: archivio/canti/[node:title]
- on path archivio/canti I've a solr views with a list of "canto" nodes (so there paths like archivio/canti?page=X or archivio/canti?f[0]=my_field=value

I would like to add a Rule (or a custom module) that, when I save a node of type "canto" ask expire to purge all pages like "archivio/canti?*", but paths like "archivio/canti/*" should not be purged.

Which syntax should I use, from PHP, to obtain this result?

Thanks a lot for this great module.

Sergio

Comments

uzuri’s picture

I'm curious about this, too; I've got a paged news feed with a similar structure and if you just update the first page stories get lost in the cracks.

arrubiu’s picture

I solvedin a "custom" way.
On a custom module, on hook_node_insert, update & delete, I call varnish function to purge pages based on regular expression, in this way (I use varnish):

<?php

/**
* Implements hook_node_insert
*/
function mymodule_node_insert($node) {
  mydmodule_purge_clear_cache($node);
}

/**
* Purge varnish cache
* @param type $node
*/
function mymodule_purge_clear_cache($node) {
  $varnish_host = _varnish_get_host();
  switch ($node->type) {
    case 'canto':
      $path = 'archivio/canti';
      // Clear the main page of node list
      varnish_purge($varnish_host, '^/' . $path);

      // Clear every "child" page of node list
      varnish_purge($varnish_host, '^/' . $path . '[^/].+$');

      break;
  }
}

?>
Attenction: this module does not call expire hooks.

Spleshka’s picture

Guys, what stops you from using hooks that are provided by expire module? See expire.api.php to get more info and examples.

Spleshka’s picture

Status: Active » Closed (works as designed)

Currently for such custom needs you are free to implement hook_cache_expire() and add your custom logic there.