0

What is the difference between DRUPAL_CACHE_PER_PAGE and DRUPAL_NO_CACHE?

I'm developing a module that will generate 2 blocks for menu and it's sub-menu in different blocks and can't decide between those two options for the blocks.

links: https://api.drupal.org/api/drupal/includes%21common.inc/constant/DRUPAL_NO_CACHE/7 https://api.drupal.org/api/drupal/includes%21common.inc/constant/DRUPAL_CACHE_PER_PAGE/7

1
  • Welcome to Drupal Answers! What don't you understand in "The block or element can change depending on the page being viewed"?
    – apaderno
    Apr 19, 2015 at 3:15

1 Answer 1

2
  • DRUPAL_NO_CACHE doesn't cache the item, ever.
  • DRUPAL_CACHE_PER_PAGE caches the item per page url -- this is useful for example if the block changes with a url context.
3
  • What means caches the item per page url?
    – Axel Stone
    Apr 18, 2015 at 23:53
  • 1
    It means that, if you visit twice a page like node/1 and the block is visibile on those pages, the second time the block will be rendered from the cache.
    – apaderno
    Apr 19, 2015 at 3:14
  • thanks, I think I could use DRUPAL_CACHE_PER_PAGE in this case
    – Axel Stone
    Apr 19, 2015 at 8:47

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.