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.)?



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.

|improve this answer|||||
  • 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? – Jordan Magnuson Oct 24 '12 at 19:08
  • Again, still Yes. :) – Berdir Oct 24 '12 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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