8

I guess my whole question is pretty much in the title... I'm wondering if blocks that use DRUPAL_CACHE_PER_PAGE get cached on pager pages (i.e. mysite.com/frontpage?page=3), or if the pager query is disregarded (so the block would only be cached once for frontpage, frontpage?page=2, frontpage?page=3, etc.)?

1 Answer 1

5

Yes.

See drupal_page_get_cache() in bootstrap.inc:

if (drupal_page_is_cacheable()) {
  $cache = cache_get($base_root . request_uri(), 'cache_page');
  if ($cache !== FALSE) {
    $cache_hit = TRUE;
  }
  return $cache;
}

request_uri() returns the whole path including any GET arguments.

2
  • 1
    Yikes. So if I have frontpage?page=1, frontpage?page=2, frontpage?page=3 ... frontpage?page=100, then the block will be cached 100 separate times in the db? Oct 24, 2012 at 19:08
  • Again, still Yes. :)
    – Berdir
    Oct 24, 2012 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.