BlockCacheKind.php

BlockCacheKind

Namespace

Drupal\ooe\Block

File

lib/Drupal/ooe/Block/BlockCacheKind.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * BlockCacheKind
  5. */
  6. namespace Drupal\ooe\Block;
  7. /**
  8. * Encapsulates some block caching bitmask constants
  9. * referenced in hook_block_info().
  10. *
  11. * 'cache: (optional) A bitmask describing what kind
  12. * of caching is appropriate for the block. Drupal provides
  13. * the following bitmask constants for defining cache granularity:
  14. *
  15. * DRUPAL_CACHE_PER_ROLE (default): The block can change depending
  16. * on the roles the user viewing the page belongs to.
  17. *
  18. * DRUPAL_CACHE_PER_USER: The block can change depending on the
  19. * user viewing the page. This setting can be resource-consuming
  20. * for sites with large number of users, and should only be
  21. * used when DRUPAL_CACHE_PER_ROLE is not sufficient.
  22. *
  23. * DRUPAL_CACHE_PER_PAGE: The block can change
  24. * depending on the page being viewed.
  25. *
  26. * DRUPAL_CACHE_GLOBAL: The block is the same for every user
  27. * on every page where it is visible.
  28. *
  29. * DRUPAL_CACHE_CUSTOM: The module implements
  30. * its own caching system.
  31. *
  32. * DRUPAL_NO_CACHE: The block should not get cached.'
  33. *
  34. * UML: @link http://drupal7demo.webel.com.au/node/1148 BlockCacheKind @endlink
  35. *
  36. * @author darrenkelly
  37. */
  38. class BlockCacheKind {
  39. /**
  40. * '(default): The block can change depending on
  41. * the roles the user viewing the page belongs to.'
  42. */
  43. const CACHE_PER_ROLE = DRUPAL_CACHE_PER_ROLE;
  44. /**
  45. * 'The block can change depending on the user viewing the page.
  46. * This setting can be resource-consuming
  47. * for sites with large number of users,
  48. * and should only be used when DRUPAL_CACHE_PER_ROLE is not sufficient.'
  49. */
  50. const CACHE_PER_USER = DRUPAL_CACHE_PER_USER;
  51. /**
  52. * 'The block can change depending on the page being viewed.'
  53. */
  54. const CACHE_PER_PAGE = DRUPAL_CACHE_PER_PAGE;
  55. /**
  56. * 'The block is the same for every user
  57. * on every page where it is visible.'
  58. */
  59. const CACHE_GLOBAL = DRUPAL_CACHE_GLOBAL;
  60. /**
  61. * 'The module implements its own caching system.'
  62. */
  63. const CACHE_CUSTOM = DRUPAL_CACHE_CUSTOM;
  64. /**
  65. * 'The block should not get cached.'
  66. */
  67. const NO_CACHE = DRUPAL_NO_CACHE;
  68. }

Classes

Namesort descending Description
BlockCacheKind Encapsulates some block caching bitmask constants referenced in hook_block_info().