You are here

README.txt in Flush page cache 7

Same filename and directory in other branches
  1. 6 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:

    // Wrapper class for extending DrupalDatabaseCache to support flushing a page's cache.
    $conf['cache_backends'][] = './sites/all/modules/flush_page_cache/flush_page_cache.cache.inc';
    $conf['cache_default_class'] = 'FlushPageCacheDrupalDatabaseCache';

   See the notes section below for an explanation.

2b.If you're using a contrib module, you will need to build the flush page cache
   wrapper class. Below is an example of the wrapper class for the Memcache module.
   Please since the memcache.inc in being required in settings.php you do not
   need to add it to the $conf['cache_backends'][].

    // Wrapper class for extending MemCacheDrupal to support flushing a page's cache.
    require_once DRUPAL_ROOT . '/includes/cache.inc';
    require_once DRUPAL_ROOT . '/sites/all/modules/memcache/memcache.inc';
    class FlushPageCacheMemCacheDrupal extends MemCacheDrupal {
      function get($cid) {
        // 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;
        }

        return parent::get($cid);
      }
    }
    $conf['cache_default_class'] = 'FlushPageCacheMemCacheDrupal';

    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
   'Configuration > Development > Flush_page_cache'
   (admin/config/development/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 extends the default cache class (ie 'DrupalDatabaseCache')
  to create flush page cache class (ie 'FlushPageCacheDrupalDatabaseCache'
  which just contains the extra code required to support flushing a page's cache.

- 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. // Wrapper class for extending DrupalDatabaseCache to support flushing a page's cache.
  53. $conf['cache_backends'][] = './sites/all/modules/flush_page_cache/flush_page_cache.cache.inc';
  54. $conf['cache_default_class'] = 'FlushPageCacheDrupalDatabaseCache';
  55. See the notes section below for an explanation.
  56. 2b.If you're using a contrib module, you will need to build the flush page cache
  57. wrapper class. Below is an example of the wrapper class for the Memcache module.
  58. Please since the memcache.inc in being required in settings.php you do not
  59. need to add it to the $conf['cache_backends'][].
  60. // Wrapper class for extending MemCacheDrupal to support flushing a page's cache.
  61. require_once DRUPAL_ROOT . '/includes/cache.inc';
  62. require_once DRUPAL_ROOT . '/sites/all/modules/memcache/memcache.inc';
  63. class FlushPageCacheMemCacheDrupal extends MemCacheDrupal {
  64. function get($cid) {
  65. // Handle flush page cache request by deleting the cached object and returning FALSE.
  66. if (function_exists('flush_page_cache_requested') && flush_page_cache_requested()) {
  67. return FALSE;
  68. }
  69. return parent::get($cid);
  70. }
  71. }
  72. $conf['cache_default_class'] = 'FlushPageCacheMemCacheDrupal';
  73. See the notes section below for an explanation.
  74. 3. Give the appropriate permissions to the appropriate roles on the permissions
  75. page. The "flush page cache" permission allows a user to see the button and
  76. perform the action and should only be given to trusted roles.
  77. 4. Optionally, you may configure additional settings on the form located at
  78. 'Configuration > Development > Flush_page_cache'
  79. (admin/config/development/flush_page_cache). See the notes section below on what you
  80. may want to add in the "custom settings" area on this page.
  81. 5. Optionally, you may place the "Flush page cache" block on your pages. It's
  82. recommended you only allow this for trusted roles. It may be useful to
  83. style this block to a fixed position on the page for ease of use.
  84. NOTES
  85. -----
  86. - This module works by forcing Drupal's cache_get() function to always delete
  87. the cached object and return a NULL object.
  88. This module extends the default cache class (ie 'DrupalDatabaseCache')
  89. to create flush page cache class (ie 'FlushPageCacheDrupalDatabaseCache'
  90. which just contains the extra code required to support flushing a page's cache.
  91. - Modules implement caching mechanisms in very diverse ways; for example, they
  92. may cache by role or by language or even by user. Because of the way this
  93. module works, it may only clear the cache for you. To get around this, you can
  94. define custom cache IDs, tables, and paths on the configuration page.
  95. EXAMPLE CUSTOM SETTINGS
  96. -----------------------
  97. - If you want to clear all view caches for the "blog" view when you flush the
  98. cache at http://example.com/blog, add the following custom setting:
  99. Path = blog
  100. Cache ID = blog:
  101. Table = cache_views_data
  102. Wildcard = TRUE
  103. - If you want to clear block 12's cache on all paths beginning with "about", add
  104. the following custom setting:
  105. Path = about/*
  106. Cache ID = block:12:
  107. Table = cache_block
  108. Wildcard = TRUE
  109. - If you want to clear the entire page cache every time you flush a page's cache
  110. (this is a horrible idea, but it's possible) add the following custom setting:
  111. Path = *
  112. Cache ID = *
  113. Table = cache_page
  114. Wildcard = TRUE
  115. This is a very extensible system, since it basically adds a GUI to Drupal's
  116. cache_clear_all() function. You may need to do some research into how Drupal and
  117. some contrib modules store their cached objects before you can use this fully.
  118. MAINTAINERS
  119. -----------------
  120. - Eric Peterson (iamEAP)
  121. http://drupal.org/user/1467594
  122. - Jacob Rockowitz (jrockowitz)
  123. http://drupal.org/user/371407