I'm adding some revised documentation for DrupalCacheInterface. The instructions specify to set a variable called "cache_page" to override the cache_page bin.
This is incorrect because _cache_get_object() looks for a variable named "cache_class_" . $bin:
function _cache_get_object($bin) {
// We do not use drupal_static() here because we do not want to change the
// storage of a cache bin mid-request.
static $cache_objects;
if (!isset($cache_objects[$bin])) {
$class = variable_get('cache_class_' . $bin);
if (!isset($class)) {
$class = variable_get('cache_default_class', 'DrupalDatabaseCache');
}
$cache_objects[$bin] = new $class($bin);
}
return $cache_objects[$bin];
}
The revised documentation mentions the correct naming convention.
I also added a block about creating a fully custom cache bin. I think that this will be as common as overriding Drupal's cache bins. The extra documentation will help.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | cache.inc_.drupalcacheinterfacedocs.patch | 1.24 KB | jhodgdon |
| #5 | cache_bin_889366_5.patch | 1.21 KB | kevin hankens |
| cache.inc_.drupalcacheinterfacedocs.patch | 1.24 KB | kevin hankens |
Comments
Comment #1
jhodgdonGood catch!
I think this is a good addition to the documentation. Thanks!
Comment #2
jhodgdoncache.inc_.drupalcacheinterfacedocs.patch queued for re-testing.
Comment #3
dries commentedCommitted to CVS HEAD. Thanks.
Comment #5
kevin hankens commentedSo, it looks like the previously committed patch has been overwritten, though I don't see anything in the log that suggests it was ever committed. ???
Anyway, I think that this is an important patch, because the documentation is incorrect.
Thx!
Comment #6
jhodgdonYou have to roll patches starting from Drupal head. Please read
http://drupal.org/patch/create
But you are correct, it doesn't look like the patch in the original issue report was ever committed (which is the same as the one in #5 except that it is rolled correctly). So attaching that patch again to send to the test bot.
Comment #7
dries commentedCommitted to CVS HEAD. Thanks.
Comment #8
kevin hankens commentedOops, yeah, that was my bad. Thx for resubmitting!