You are here

README.txt in Flush page cache 6

Same filename and directory in other branches
  1. 7 README.txt
CONTENTS OF THIS FILE
---------------------

 * Introduction
 * Features
 * Use Cases
 * Recommended Modules
 * Installation
 * Example Custom Settings
 * Maintainers


INTRODUCTION
------------

Easing the pain when you need to flush...Drupal's cache.

Flushing Drupal's cache on a large site can feel like you're waiting to takeoff
on the tarmac at JFK. The delay comes from the fact that when you clear Drupal's
cache, it clears everything. Most of time you just want to flush the cache
for specific object on a page.

The 'Flush page cache' module solves this problem by flushing only the cached
objects for a single page. Additionally, you can define custom objects and
cache tables to be cleared on specific pages.


FEATURES
--------

- Many button placement options including: in the page footer or with a block.
  If you use the Administration Menu module, a link is included here as well.

- The ability to define specific cache objects to be cleared when flushing page
  caches.

- Varnish integration, which also purges the cached page from Varnish.


USE CASES
---------

- You have nodes nested in views nested in a panel page. You've edited a node
  that's displayed on this page, but you want the change to be seen immediately.

- You have a large team of non-technical content editors who frequently run into
  the scenario above and you want to give them an easy, one-button solution to
  their content being updated in the lists they manage.

- You've just cleared the entire website's cache through the normal means and
  for whatever reason, a few pages are rendered and cached in a broken state.


RECOMMENDED MODULES
-------------------

- Administration Menu: Provides a theme-independent administration interface.
  http://drupal.org/project/admin_menu

- Memcache: High performance integration with memcache.
  http://drupal.org/project/memcache

- APC - Alternative PHP Cache: Provides a user cache for storing application
  data.
  http://drupal.org/project/apc

- Varnish: Provides integration with the Varnish HTTP accelerator.
  http://drupal.org/project/varnish


INSTALLATION
------------

1. Download and enable the flush_page_cache module in the usual Drupal way.

2a.If you're using Drupal default caching you will need to add the following to
   your settings.php file:

   $conf['cache_inc'] = './sites/all/modules/flush_page_cache/flush_page_cache.cache.inc';

   See the notes section below for an explanation.

2b.If you're using a contrib module, like Memcache, for caching you will need
   to add the following code to the module's cache_inc file cache_get()
   function.

    function cache_get($cid, $table = 'cache') {
      // Handle flush page cache request by deleting the cached object and returning FALSE.
      if (function_exists('flush_page_cache_requested') && flush_page_cache_requested()) {
        return FALSE;
      }

      ...
    }

   See the notes section below for an explanation.

3. Give the appropriate permissions to the appropriate roles on the permissions
   page. The "flush page cache" permission allows a user to see the button and
   perform the action and should only be given to trusted roles.

4. Optionally, you may configure additional settings on the form located at
   'Administer > Site configuration > Flush_page_cache'
   (admin/settings/flush_page_cache). See the notes section below on what you
   may want to add in the "custom settings" area on this page.

5. Optionally, you may place the "Flush page cache" block on your pages. It's
   recommended you only allow this for trusted roles. It may be useful to
   style this block to a fixed position on the page for ease of use.


NOTES
-----

- This module works by forcing Drupal's cache_get() function to always delete
  the cached object and return a NULL object.

  This module re-implements Core's cache.inc file, so that you don't have to
  hack core (http://drupal.org/best-practices/do-not-hack-core) and adds the
  required conditional break point. There is no danger to using this cache file,
  as it is virtually identical to Core's cache file.

  Those using a contrib module, like Memcache, will need to manually update the
  contrib module's 'cache_inc' file's cache_get() function.

  For more information see:
  http://2bits.com/articles/examples-drupal-custom-caching-adding-cache-timestamp-cached-pages.html


- Modules implement caching mechanisms in very diverse ways; for example, they
  may cache by role or by language or even by user. Because of the way this
  module works, it may only clear the cache for you. To get around this, you can
  define custom cache IDs, tables, and paths on the configuration page.


EXAMPLE CUSTOM SETTINGS
-----------------------

- If you want to clear all view caches for the "blog" view when you flush the
  cache at http://example.com/blog, add the following custom setting:

  Path = blog
  Cache ID = blog:
  Table = cache_views_data
  Wildcard = TRUE

- If you want to clear block 12's cache on all paths beginning with "about", add
  the following custom setting:

  Path = about/*
  Cache ID = block:12:
  Table = cache_block
  Wildcard = TRUE

- If you want to clear the entire page cache every time you flush a page's cache
  (this is a horrible idea, but it's possible) add the following custom setting:

  Path = *
  Cache ID = *
  Table = cache_page
  Wildcard = TRUE

This is a very extensible system, since it basically adds a GUI to Drupal's
cache_clear_all() function. You may need to do some research into how Drupal and
some contrib modules store their cached objects before you can use this fully.


MAINTAINERS
-----------------

- Eric Peterson (iamEAP)
  http://drupal.org/user/1467594

- Jacob Rockowitz (jrockowitz)
  http://drupal.org/user/371407

File

README.txt
View source
  1. CONTENTS OF THIS FILE
  2. ---------------------
  3. * Introduction
  4. * Features
  5. * Use Cases
  6. * Recommended Modules
  7. * Installation
  8. * Example Custom Settings
  9. * Maintainers
  10. INTRODUCTION
  11. ------------
  12. Easing the pain when you need to flush...Drupal's cache.
  13. Flushing Drupal's cache on a large site can feel like you're waiting to takeoff
  14. on the tarmac at JFK. The delay comes from the fact that when you clear Drupal's
  15. cache, it clears everything. Most of time you just want to flush the cache
  16. for specific object on a page.
  17. The 'Flush page cache' module solves this problem by flushing only the cached
  18. objects for a single page. Additionally, you can define custom objects and
  19. cache tables to be cleared on specific pages.
  20. FEATURES
  21. --------
  22. - Many button placement options including: in the page footer or with a block.
  23. If you use the Administration Menu module, a link is included here as well.
  24. - The ability to define specific cache objects to be cleared when flushing page
  25. caches.
  26. - Varnish integration, which also purges the cached page from Varnish.
  27. USE CASES
  28. ---------
  29. - You have nodes nested in views nested in a panel page. You've edited a node
  30. that's displayed on this page, but you want the change to be seen immediately.
  31. - You have a large team of non-technical content editors who frequently run into
  32. the scenario above and you want to give them an easy, one-button solution to
  33. their content being updated in the lists they manage.
  34. - You've just cleared the entire website's cache through the normal means and
  35. for whatever reason, a few pages are rendered and cached in a broken state.
  36. RECOMMENDED MODULES
  37. -------------------
  38. - Administration Menu: Provides a theme-independent administration interface.
  39. http://drupal.org/project/admin_menu
  40. - Memcache: High performance integration with memcache.
  41. http://drupal.org/project/memcache
  42. - APC - Alternative PHP Cache: Provides a user cache for storing application
  43. data.
  44. http://drupal.org/project/apc
  45. - Varnish: Provides integration with the Varnish HTTP accelerator.
  46. http://drupal.org/project/varnish
  47. INSTALLATION
  48. ------------
  49. 1. Download and enable the flush_page_cache module in the usual Drupal way.
  50. 2a.If you're using Drupal default caching you will need to add the following to
  51. your settings.php file:
  52. $conf['cache_inc'] = './sites/all/modules/flush_page_cache/flush_page_cache.cache.inc';
  53. See the notes section below for an explanation.
  54. 2b.If you're using a contrib module, like Memcache, for caching you will need
  55. to add the following code to the module's cache_inc file cache_get()
  56. function.
  57. function cache_get($cid, $table = 'cache') {
  58. // Handle flush page cache request by deleting the cached object and returning FALSE.
  59. if (function_exists('flush_page_cache_requested') && flush_page_cache_requested()) {
  60. return FALSE;
  61. }
  62. ...
  63. }
  64. See the notes section below for an explanation.
  65. 3. Give the appropriate permissions to the appropriate roles on the permissions
  66. page. The "flush page cache" permission allows a user to see the button and
  67. perform the action and should only be given to trusted roles.
  68. 4. Optionally, you may configure additional settings on the form located at
  69. 'Administer > Site configuration > Flush_page_cache'
  70. (admin/settings/flush_page_cache). See the notes section below on what you
  71. may want to add in the "custom settings" area on this page.
  72. 5. Optionally, you may place the "Flush page cache" block on your pages. It's
  73. recommended you only allow this for trusted roles. It may be useful to
  74. style this block to a fixed position on the page for ease of use.
  75. NOTES
  76. -----
  77. - This module works by forcing Drupal's cache_get() function to always delete
  78. the cached object and return a NULL object.
  79. This module re-implements Core's cache.inc file, so that you don't have to
  80. hack core (http://drupal.org/best-practices/do-not-hack-core) and adds the
  81. required conditional break point. There is no danger to using this cache file,
  82. as it is virtually identical to Core's cache file.
  83. Those using a contrib module, like Memcache, will need to manually update the
  84. contrib module's 'cache_inc' file's cache_get() function.
  85. For more information see:
  86. http://2bits.com/articles/examples-drupal-custom-caching-adding-cache-timestamp-cached-pages.html
  87. - Modules implement caching mechanisms in very diverse ways; for example, they
  88. may cache by role or by language or even by user. Because of the way this
  89. module works, it may only clear the cache for you. To get around this, you can
  90. define custom cache IDs, tables, and paths on the configuration page.
  91. EXAMPLE CUSTOM SETTINGS
  92. -----------------------
  93. - If you want to clear all view caches for the "blog" view when you flush the
  94. cache at http://example.com/blog, add the following custom setting:
  95. Path = blog
  96. Cache ID = blog:
  97. Table = cache_views_data
  98. Wildcard = TRUE
  99. - If you want to clear block 12's cache on all paths beginning with "about", add
  100. the following custom setting:
  101. Path = about/*
  102. Cache ID = block:12:
  103. Table = cache_block
  104. Wildcard = TRUE
  105. - If you want to clear the entire page cache every time you flush a page's cache
  106. (this is a horrible idea, but it's possible) add the following custom setting:
  107. Path = *
  108. Cache ID = *
  109. Table = cache_page
  110. Wildcard = TRUE
  111. This is a very extensible system, since it basically adds a GUI to Drupal's
  112. cache_clear_all() function. You may need to do some research into how Drupal and
  113. some contrib modules store their cached objects before you can use this fully.
  114. MAINTAINERS
  115. -----------------
  116. - Eric Peterson (iamEAP)
  117. http://drupal.org/user/1467594
  118. - Jacob Rockowitz (jrockowitz)
  119. http://drupal.org/user/371407