tags:

views:

53

answers:

2

I'm developing a site in Drupal 6, and I'm going mad trying to work out why pages (specifically pages containing views), I'm working on locally are caching content instead refreshing the contents of the page, and that of linked js files, I'm relying on for making a mashup - is there a checklist I can check against to be sure I'm not missing when trying to deactivate caching?

These are the steps I'm taking:

On the server:
  • set the site to rebuild the theme on each load
  • cleared cache using drush (as in drush @dev cc all`) on each page load
  • checked that the json output from a view isn't caching
  • disabled any css or js caching in admin/settings/performance
On Firefox/firebug
  • using the web developer extension, disabled the cache
  • been refreshing the site using shift-F5 to force a clear of the cache

I'm not using varnish or memcached, nor any other caching modules like boost - it's straight Apache-PHP through to Drupal and MySQL.

What am I missing here?

A: 

First you don't need to do drastic things like clear cache using drush @dev cc all on each page load. Also you really don't need to have the theme registry get built on every page load unless you're doing some theme development

  1. Make sure that page caching is set to disabled at /admin/settings/performance
  2. Make sure you don't have some funny .htaccess rules in your drupal site and your .htaccess is the default one that comes with drupal. You might want to make sure the headers for html files generated by Drupal have an expiry in the past and the html has no-cache in the header.You have already clarified you're not using boost, varnish, memcached. It might be a good idea to make sure mod_expires apache module is enabled also.
  3. Make sure in each view under Basic Settings Caching is set to None [I suspect this might be a source of your views not updating]
  4. Are you using windows? If so its not the best environment for apache + PHP and I'll recommend you install Ubuntu 9.10 or an earlier in VirtualBox (Recommending Ubuntu 9.10 or earlier as it has PHP 5.2. PHP 5.3 is not very well supported by Drupal). You can use the seamless mode -- its really very cool.
Sid NoParrots
+3  A: 

The three things you need to do are:

  1. Go to Site Configuration -> Performance:
    • Set the following options, and click Save configuration:
      • Caching mode: Disabled
      • Minimum cache lifetime: none
      • Page compression: Disabled
      • Block cache: Disabled
      • Optimize CSS files: Disabled
      • Optimize JavaScript files: Disabled
    • Click Clear cached data.
  2. Go to Site building -> Views -> Tools:
    • Check Disable views data caching and click Save configuration.
    • Click Clear Views' cache.
  3. Install the Devel module, and go to Site Configuration -> Devel settings:
    • Check Rebuild the theme registry on every page load and click Save configuration.

This will make sure all registries and caches except for the menu router will be rebuilt on every page, effectively preventing caching in practice.

If you really need the menu router to be rebuilt on every page (it's completely unnecessary, as you only need to worry about it when you change your implementation for hook_menu() or hook_menu_alter()), you could add menu_rebuild() to hook_init() in a custom module:

function mymodule_init() {
  menu_rebuild();
} 
Mark Trapp