Drupal $custom_theme caching issues? I have a hook_boot() module that detects certain circumstances and changes the theme using $custom_theme to a specific theme. All works good, however if Drupal has a cache of the page that page will be served regardless of the fact it is not the correct theme.

Is there anyway to force drupal not to use and caches for that specific theme? Or is there a way to force drupal to keep two caches? One for each theme?

I am using Drupal 6 btw.
From my point of view, the better way is to use your own cache system, but don't worry is nothing very complicate.

Copy the includes/cache.inc and put it somewhere in sites/all/libraries or whatever you want. After in your settings.php you've to add $config['cache_inc'] = 'sites/all/...'; and Drupal will replace is own cache system by yours. This file contains three functions, clear_cache_all, cache_set and cache_get. Here the idea is to add the name of your theme before all $cid.

I never tried it, so I'm not sure if you can have access to this informations, but you can try .