Fabian implemented this, I'm just rolling it for him.

This allows settings things up to allow serving pages from memcache without needing to bootstrap the database, etc.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bdragon created an issue. See original summary.

bdragon’s picture

Status: Active » Needs review
FileSize
4.33 KB
joegraduate’s picture

Status: Needs review » Needs work
  1. +++ b/d8cache.module
    @@ -170,3 +182,94 @@ function _d8cache_cache_tags_calculate_checksum(array $tags) {
    +  $result = [];
    

    For the sake of consistency with existing code in this module (and because Drupal 7 technically supports PHP < 5.4), it'd probably be best not to use short array syntax.

  2. +++ b/d8cache.module
    @@ -170,3 +182,94 @@ function _d8cache_cache_tags_calculate_checksum(array $tags) {
    +    return [];
    

    return array();

  3. +++ b/d8cache.module
    @@ -170,3 +182,94 @@ function _d8cache_cache_tags_calculate_checksum(array $tags) {
    +    return [];
    

    return array();

  4. +++ b/d8cache.module
    @@ -170,3 +182,94 @@ function _d8cache_cache_tags_calculate_checksum(array $tags) {
    +  $result = [];
    

    $result = array();

joegraduate’s picture

Status: Needs work » Needs review
FileSize
3.95 KB
1.15 KB
bdragon’s picture

Blame PHPStorm for that one. It changed them while I was looking the other way.

vinmassaro’s picture

I tested the patch in #3 with D8cache, Authcache, and Redis, with the below config in settings.php. I get some weird behavior with authcache_debug where it doesn't report out all of the timing info as it does without this patch and not setting $conf['authcache_builtin_cache_without_database'] = TRUE;. The only thing I can tell is that d8cache no longer throws `Call to undefined function db_query() in _d8cache_cache_tags_calculate_checksum' errors when setting $conf['authcache_builtin_cache_without_database'] = TRUE;, so that seems to work.

// D8cache
$conf['cache_backends'][] = 'sites/all/modules/contrib/d8cache/d8cache-ac.cache.inc';
$conf['cache_class_cache_views_data'] = 'D8CacheAttachmentsCollector';
$conf['cache_class_cache_block'] = 'D8CacheAttachmentsCollector';
$conf['cache_class_cache_page'] = 'D8Cache';

// Redis
$conf['redis_client_interface'] = 'PhpRedis';
$conf['cache_backends'][] = 'sites/all/modules/contrib/redis/redis.autoload.inc';
$conf['cache_default_class'] = 'Redis_Cache';
$conf['cache_prefix'] = array('default' => 'pantheon-redis');
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['d8cache_cache_class_cache_page'] = 'Redis_Cache';
$conf['lock_inc'] = 'sites/all/modules/contrib/redis/redis.lock.inc';

// Authcache
$conf['cache'] = '0';
$conf['cache_backends'][] = 'sites/all/modules/contrib/authcache/authcache.cache.inc';
$conf['cache_backends'][] = 'sites/all/modules/contrib/authcache/modules/authcache_builtin/authcache_builtin.cache.inc';
$conf['authcache_builtin_cache_without_database'] = TRUE;
$conf['cache_class_cache_authcache_key'] = 'Redis_Cache';
$conf['cache_lifetime'] = 10800;
bdragon’s picture

Ignore this patch, it's for some internal testing over here and I need to be able to apply it alongside some other changes that touch the same code.

stevector’s picture

Should there be an update to the readme with this patch?

The current readme seems to imply that d8cache can be used with Redis/Memcache but that the d8cache bins still use the database.


- How can I specify a class to use as backend for D8Cache if my bin uses a
  different backend from the default?

Before:

  $conf['cache_default_class'] = 'Redis_Cache';
  $conf['cache_class_cache_page'] = 'DrupalDatabaseCache';

After:

  $conf['cache_default_class'] = 'Redis_Cache';
  $conf['cache_class_cache_page'] = 'D8Cache';
  $conf['d8cache_cache_class_cache_page'] = 'DrupalDatabaseCache';
Fabianx’s picture

Assigned: Unassigned » bdragon
Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community
Issue tags: +release notes
+++ b/d8cache.module
@@ -238,3 +250,94 @@ function _d8cache_cache_tags_calculate_checksum(array $tags) {
+  _drupal_bootstrap_database();

We should call drupal_bootstrap instead of calling this directly.

---

Except for that, this is RTBC, over to Brandon

  • bdragon authored c9c61e5 on 7.x-1.x
    Issue #2995169 by bdragon, joegraduate, vinmassaro, Fabianx: Allow...
bdragon’s picture

Status: Reviewed & tested by the community » Active
Issue tags: +Needs documentation

Committed, back to active for documentation

  • 575a0de committed on 7.x-1.x
    Add documentation for #2995169.
    
bdragon’s picture

Status: Active » Fixed
Issue tags: -Needs documentation

Documentation written.

Status: Fixed » Closed (fixed)

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