The project page Drupal 7 settings currently suggest putting the following in your settings.php file:

$conf['cache_default_class'] = 'GracefulCache';

However, this should be:

$conf['cache_default_class'] = 'CacheGraceful';

Comments

geerlingguy’s picture

Of course, either way I go, I get the following error message :(

Fatal error: Class 'GracefulCache' not found in siteroot/includes/cache.inc on line 31
gielfeldt’s picture

<?php
$conf['cache_default_class'] = 'GracefulCache';
?>

Is correct. The class is located in cache_graceful.inc.

However, you also need to instruct Drupal's cache mechanism to load the cache_graceful.inc file:

<?php
$conf['cache_backends'] = array(
  // change this to the location of your installed cache graceful module
  'sites/all/modules/cache_graceful/cache_graceful.inc',
);
?>

If you get this error:

Fatal error: Class 'GracefulCache' not found in siteroot/includes/cache.inc on line 31

With this setting:

<?php
$conf['cache_default_class'] = 'CacheGraceful';
?>

Then my first assumption would be that you are looking at the wrong settings files, since CacheGraceful != GracefulCache.

Are you using an opcode cache? These can play tricks on you, if it's not configured to reload files that have changed.

There's a file in the cache graceful module called "CacheGraceful.class.php", but that's an old obsolete file, which I've forgot to remove. It is not used.

geerlingguy’s picture

Hmm... I've set the following two configuration variables, and now I'm getting the following:

1. If I set cache_backends to sites/all/modules/cache_graceful/cache_graceful.inc, I get the following error on every page load:

Warning: Invalid argument supplied for foreach() in _drupal_bootstrap_page_cache() (line 2296 of /Users/jgeerling/Sites/flocknote/includes/bootstrap.inc).

2. If I also set cache_default_class to GracefulCache, I get the following error (and a WSOD):

Fatal error: Class 'GracefulCache' not found in ../siteroot/includes/cache.inc on line 31

I can't seem to get the module working one way or another... I have APC enabled, but I have apc.stat set to 1. I've also tried restarting apache/php, to no avail.

geerlingguy’s picture

Ah, nevermind; I just realized that I needed to pass in the cache_backend as an array, and not a string. Both problems fixed.

One other note—shouldn't cache_graceful.inc be added to the files[] array in the .info file so it's added to Drupal's class registry?

--- cache_graceful.info (saved version)
+++ (current document)
@@ -6,6 +6,7 @@
 
 configure = admin/config/system/cache_graceful
 files[] = cache_graceful_views_plugin_cache_graceful.inc
+files[] = cache_graceful.inc
 
 
 ; Information added by drupal.org packaging script on 2012-10-06
gielfeldt’s picture

Hi Jeff

Ok. Great.

Not sure if it's necessary to add it to the registry through files[], since the "cache_backends" works as it's own "registry". But maybe it's a good idea, I'll look into it.

Thanks

geerlingguy’s picture

Status: Active » Fixed

Sounds good!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.