Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By krato on
Hello,
I'm developing a module and I need to disable cache for one page of pages in my module. It's page cpg_bridge_connector.
btw: Complete current working code of my module cpg_bridge is available at:
http://www.krato.cz/clanky/drupal-5-x-coppermine-gallery-1-4-x-bridge-ve...
(final version will be available at drupal.org module list)
Here is my menu hook function:
/**
* Implementation of hook_menu();
*/
function cpg_bridge_menu($may_cache) {
if (!$may_cache) {
$items[] = array(
'path' => 'admin/settings/cpg_bridge',
'title' => t('Coppermine bridge'),
'description' => t('Configure coppermine gallery bridge.'),
'callback' => 'drupal_get_form',
'callback arguments' => array('cpg_bridge_settings'),
'access' => user_access('administer cpg_bridge'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'cpg_bridge_connector',
'title' => 'cpg_bridge_connector',
'callback' => 'cpg_bridge_connector',
'callback arguments' => array(),
'access' => user_access('access content'),
'type' => MENU_LOCAL_TASK,
);
}
return $items;
}
Comments
PHP - CF
THINK I NEED TO TRANSLATE THIS TO COLDFUSION.
thanks for this krato.
$conf
If you set $GLOBALS['conf']['cache'] = FALSE, that will disable the page cache (and only the page cache) on that page request, regardless of what the UI is set to.
See the CacheExclude module for an example and some UI that may be helpful as well.
--
Larry Garfield
http://www.garfieldtech.com/
Thinking Functionally in PHP: https://leanpub.com/thinking-functionally-in-php
Proper way to exclude a page or callback from caching Drupal 7
Rounding back here on this 8 year old thread to say that the preferred method of disabling Drupal server cache for a page or block or Services API REST response or whatever is
drupal_page_is_cacheable(FALSE);
in the callback.--
http://drupaltees.com
80s themed Drupal T-Shirts
Disable single page cache for Drupal 8