hey

these Cache APIs/backends work fully with Cache Backport:
- File Cache (D7, no patch required) - sucessor to fastpath_fscache and Cache Router
- APC - Alternative PHP Cache (D7, no patch required) - sucessor to Cache Router
- Memcache API and Integration (D7, patch required)

these Cache APIs/backends don't work yet fully with Cache Backport:
- Database / DBTNG (buggy, supplied with Cache Backport)

Configuration snippet (based on my work with Cache Router, Memcache API and AuthCache):

/**
* Cache settings: Cache Backport (cache_backport)
*
* Cache API backport from Drupal 7, running on file, db, apc, xcache or memcache engines.
*/
$module_cache_backport_enabled = FALSE; // change to TRUE to enable
$module_cache_backport_default = TRUE; // change to FALSE to specify subdomain
$module_cache_backport_inc = './sites/all/modules/cache_backport/cache.inc';
if ( $module_cache_backport_enabled == TRUE ) {
if ( file_exists($module_cache_backport_inc) ) {
  if ( $module_cache_backport_default == TRUE ) {
      $module_cache_backport_domain = 'default';
  } else {
      $module_cache_backport_domain = $_SERVER['SERVER_NAME'];
  }
  $conf['cache_inc'] = $module_cache_backport_inc;
  // DBTNG :: DrupalDatabaseCache (DON'T USE! BUGGY!)
  //$conf['cache_backends'][] = './sites/all/modules/cache_backport/database.inc';
  // File Cache :: DrupalFileCache
  $conf['cache_backends'][] = './sites/all/modules/filecache_d7/filecache.inc';
  // APC :: DrupalAPCCache
  $conf['cache_backends'][] = './sites/all/modules/apc_d7/drupal_apc_cache.inc';
  // Memcache :: MemCacheDrupal
  //$conf['cache_backends'][] = './sites/all/modules/memcache_d7/memcache.inc';
  // Cache bins:
  $conf['cache_default_class'] = 'DrupalFileCache';
  $conf['cache_class_cache'] = 'DrupalAPCCache';
  $conf['cache_class_block'] = 'DrupalFileCache';
  $conf['cache_class_bootstrap'] = 'DrupalAPCCache';
  $conf['cache_class_content'] = 'DrupalFileCache';
  $conf['cache_class_filter'] = 'DrupalAPCCache';
  $conf['cache_class_form'] = 'DrupalAPCCache';
  $conf['cache_class_menu'] = 'DrupalFileCache';
  $conf['cache_class_page'] = 'DrupalFileCache';
  //$conf['cache_class_pathdst'] = 'DrupalFileCache';
  //$conf['cache_class_pathsrc'] = 'DrupalFileCache';
  //$conf['cache_class_uc_price'] = 'DrupalFileCache';
  $conf['cache_class_update'] = 'DrupalFileCache';
  $conf['cache_class_views'] = 'DrupalFileCache';
  $conf['cache_class_views_data'] = 'DrupalAPCCache';
  //$conf['cache_session'] = 'DrupalFileCache';
  //$conf['cache_users'] = 'DrupalFileCache';
  // Extra settings:
  $conf['filecache_directory'] = './sites/' . $module_cache_backport_domain . '/files/filecache';
  //$conf['session_inc'] = './sites/all/modules/memcache_d7/memcache-session.inc';
  $conf['memcache_servers'] = array(
    '127.0.0.1:11211' => 'default',
  );
  $conf['memcache_bins'] = array(
    'cache' => 'default',
    'cache_block' => 'default',
    'cache_bootstrap' => 'default',
    'cache_content' => 'default',
    'cache_filter' => 'default',
    'cache_form' => 'default',
    'cache_menu' => 'default',
    'cache_page' => 'default',
    'cache_pathdst' => 'default',
    'cache_pathsrc' => 'default',
    'cache_uc_price' => 'default',
    'cache_update' => 'default',
    'cache_views' => 'default',
    'cache_views_data' => 'default',
    'session' => 'default',
    'users' => 'default',
  );
}
}
  • Cache Router (cacherouter): #945650 (under review)
  • Authenticated User Page Caching (authcache): #945656 (under review)
  • Memcache API and Integration (memcache): #1098730 (under review)
  • Comments

    Thanks for this hard work! You are my savior :)
    I updated the module description by adding results of your tests, and I'll start investigating the DBTNG module potential incompatibilities as soon as we resolved your gzip issue.

    Thanks again.

    Status:Needs review» Postponed

    supplied database engine seems now fixed as of alpha4

    the $conf['memcache_servers'] and $conf['memcache_bins'] config is still required on D7, to set which memcache servers cache what.
    the $conf['cache_class_****'] only specifies which cache engine deals with which tables.

    taken from README.txt in Memcache 7.x-1.x-dev:

    Here is an example configuration that has two clusters, 'default' and
    'cluster2'. Five memcached instances are divided up between the two
    clusters. 'cache_filter' and 'cache_menu' bins goe to 'cluster2'. All other
    bins go to 'default'.
    include_once('./includes/cache.inc');
    include_once('./sites/all/modules/memcache/memcache.inc');
    $conf = array(
      'cache_default_class' = 'MemCacheDrupal',
      'memcache_servers' => array('localhost:11211' => 'default',
                                  'localhost:11212' => 'default',
                                  '123.45.67.890:11211' => 'default',
                                  '123.45.67.891:11211' => 'cluster2',
                                  '123.45.67.892:11211' => 'cluster2'),
      'memcache_bins' => array('cache' => 'default',
                               'cache_filter' => 'cluster2',
                               'cache_menu' => 'cluster2'),
    );

    When reading the code, it seems that if servers is omitted, memcache uses localhost:11211, which is the default. Bins is mandatory if you have one or more servers, but it seems that all will use 'default' if you don't specify it.

    default version:

    <?php
    /**
    * Cache settings: Cache Backport (cache_backport)
    *
    * Cache API backport from Drupal 7, running on file, db, apc, xcache or memcache engines.
    */
    $module_cache_backport_enabled = FALSE; // change to TRUE to enable
    $module_cache_backport_default = TRUE;  // change to FALSE to detect subdomain
    $module_cache_backport_inc     = './sites/all/modules/cache_backport/cache.inc';
    // Conditional loading
    if ( $module_cache_backport_enabled == TRUE ) {
      // Set domain/subdomain
      if ( $module_cache_backport_default == TRUE ) {
          $module_cache_backport_domain = 'default';
      } else {
          $module_cache_backport_domain = $_SERVER['SERVER_NAME'];
      }
      // Define cache engines:
      $module_cache_backport_database             = TRUE;  // set TRUE to enable Database (DrupalDatabaseCache)
      $module_cache_backport_database_inc         = './sites/all/modules/cache_backport/database.inc';
      $module_cache_backport_filecache            = FALSE; // set TRUE to enable File Cache (DrupalFileCache)
      $module_cache_backport_filecache_inc        = './sites/all/modules/filecache_d7/filecache.inc';
      $module_cache_backport_apc                  = FALSE; // set TRUE to enable APC (DrupalAPCCache)
      $module_cache_backport_apc_inc              = './sites/all/modules/apc_d7/drupal_apc_cache.inc';
      $module_cache_backport_memcache             = FALSE; // set TRUE to enable Memcache (MemCacheDrupal)
      $module_cache_backport_memcache_inc         = './sites/all/modules/memcache_d7/memcache.inc';
      $module_cache_backport_memcache_db          = FALSE; // do not use yet
      $module_cache_backport_memcache_db_inc      = './sites/all/modules/memcache_d7/memcache.db.inc';
      $module_cache_backport_memcache_session     = FALSE; // do not use yet
      $module_cache_backport_memcache_session_inc = './sites/all/modules/memcache_d7/memcache-session.inc';
      // Load Include files
      if ( file_exists($module_cache_backport_inc) ) $conf['cache_inc'] = $module_cache_backport_inc;
      if ( $module_cache_backport_database == TRUE ) if ( file_exists($module_cache_backport_database_inc) ) $conf['cache_backends'][] = $module_cache_backport_database_inc;
      if ( $module_cache_backport_filecache == TRUE ) if ( file_exists($module_cache_backport_filecache_inc) ) $conf['cache_backends'][] = $module_cache_backport_filecache_inc;
      if ( $module_cache_backport_apc == TRUE ) if ( file_exists($module_cache_backport_apc_inc) ) $conf['cache_backends'][] = $module_cache_backport_apc_inc;
      if ( $module_cache_backport_memcache == TRUE ) if ( file_exists($module_cache_backport_memcache_inc) ) $conf['cache_backends'][] = $module_cache_backport_memcache_inc;
      if ( $module_cache_backport_memcache_database == TRUE ) if ( file_exists($module_cache_backport_memcache_database_inc) ) $conf['cache_backends'][] = $module_cache_backport_memcache_database_inc;
      if ( $module_cache_backport_memcache_session == TRUE ) if ( file_exists($module_cache_backport_memcache_session_inc) ) $conf['session_inc'] = $module_cache_backport_memcache_session_inc;
      // Define cache bins (defaults):
      $conf['cache_default_class']    = 'DrupalDatabaseCache'; // default, any/any/any, select memcache, apc, file or db
      //$conf['cache_class_bootstrap']  = 'DrupalDatabaseCache'; // bootstrap, all/every/medium, select apc > db
      $conf['cache_class_block']      = 'DrupalDatabaseCache'; // block, any/often/small, select memcache > db > file
      $conf['cache_class_cache']      = 'DrupalDatabaseCache'; // general, all/every/medium/often, select apc > db
      $conf['cache_class_content']    = 'DrupalDatabaseCache'; // field, page/some/large, select file > memcache > db
      $conf['cache_class_filter']     = 'DrupalDatabaseCache'; // filtered, page/some/large, select file > memcache > db
      $conf['cache_class_form']       = 'DrupalDatabaseCache'; // block, edit/rare/medium, select file > memcache > db
      $conf['cache_class_menu']       = 'DrupalDatabaseCache'; // menu, any/often/large, select memcache > db > file
      $conf['cache_class_page']       = 'DrupalDatabaseCache'; // node, page/often/large, select memcache > file > db
      //$conf['cache_class_pathdst']    = 'DrupalDatabaseCache'; // path, any/some/medium, select memcache > db > file
      //$conf['cache_class_pathsrc']    = 'DrupalDatabaseCache'; // path, any/some/medium, select memcache > db > file
      //$conf['cache_class_uc_price']   = 'DrupalDatabaseCache'; // multiprice, any/often/medium, select memcache > db > file
      //$conf['cache_class_session']    = 'DrupalDatabaseCache'; // session, any/any/small, select memcache > db
      $conf['cache_class_update']     = 'DrupalDatabaseCache'; // system, system/rare/large, select file > db
      //$conf['cache_class_users']      = 'DrupalDatabaseCache'; // users, any/some/large, select memcache > file > db
      $conf['cache_class_views']      = 'DrupalDatabaseCache'; // views, any/some/large, select memcache > file > db
      $conf['cache_class_views_data'] = 'DrupalDatabaseCache'; // views data, any/often/small, select apc > db
      // Define File Cache settings
      $conf['filecache_fast_pagecache'] = FALSE; // set TRUE to enable fast page serving
      $conf['filecache_directory'] = './sites/' . $module_cache_backport_domain . '/files/filecache';
      // Define APC settings
      $conf['apc_show_debug'] = FALSE; // set TRUE to enable debug mode
      // Define Memcache settings
      /*$conf['memcache_options'] = array(
        Memcached::OPT_BINARY_PROTOCOL => FALSE, // set TRUE to enable binary protocol when using memcached >= 1.4
        Memcached::OPT_COMPRESSION => FALSE, // set FALSE to disable compression for improved performance
        Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT, // set consistent distribution
        Memcached::OPT_HASH => Memcached::HASH_CRC, // set CRC32 hash method
        Memcached::OPT_CONNECT_TIMEOUT => 1000, // connection timeout in milliseconds
        Memcached::OPT_SERVER_FAILURE_LIMIT => 5, // failure limit for server connection attempts
      );*/
      $conf['memcache_servers'] = array(
        '127.0.0.1:11211' => 'default',
      );
      $conf['memcache_bins'] = array(
        'cache' => 'default',
        'cache_block' => 'default',
        //'cache_bootstrap' => 'default',
        'cache_content' => 'default',
        'cache_filter' => 'default',
        'cache_form' => 'default',
        'cache_menu' => 'default',
        'cache_page' => 'default',
        //'cache_pathdst' => 'default',
        //'cache_pathsrc' => 'default',
        //'cache_uc_price' => 'default',
        'cache_update' => 'default',
        'cache_views' => 'default',
        'cache_views_data' => 'default',
        //'session' => 'default',
        //'users' => 'default',
      );
      // Define Drupal cache settings:
      /*
      $conf['page_cache_without_database'] = TRUE;  // set TRUE to skip starting the database (first define 'cache_page' bin)
      $conf['page_cache_invoke_hooks']     = FALSE; // set FALSE to not use aggressive caching
      $conf['page_cache_maximum_age']      = $variables['page_cache_maximum_age'];
      $conf['cache_lifetime']              = $variables['cache_lifetime'];
      $conf['page_compression']            = $variables['page_compression'];
      */
    }

    optimized version:

    <?php
    /**
    * Cache settings: Cache Backport (cache_backport)
    *
    * Cache API backport from Drupal 7, running on file, db, apc, xcache or memcache engines.
    */
    $module_cache_backport_enabled = TRUE;  // change to TRUE to enable
    $module_cache_backport_default = TRUE; // change to FALSE to detect subdomain
    $module_cache_backport_inc     = './sites/all/modules/cache_backport/cache.inc';
    // Conditional loading
    if ( $module_cache_backport_enabled == TRUE ) {
      // Set domain/subdomain
      if ( $module_cache_backport_default == TRUE ) {
          $module_cache_backport_domain = 'default';
      } else {
          $module_cache_backport_domain = $_SERVER['SERVER_NAME'];
      }
      // Define cache engines:
      $module_cache_backport_database             = TRUE;  // set TRUE to enable Database (DrupalDatabaseCache)
      $module_cache_backport_database_inc         = './sites/all/modules/cache_backport/database.inc';
      $module_cache_backport_filecache            = TRUE;  // set TRUE to enable File Cache (DrupalFileCache)
      $module_cache_backport_filecache_inc        = './sites/all/modules/filecache_d7/filecache.inc';
      $module_cache_backport_apc                  = TRUE;  // set TRUE to enable APC (DrupalAPCCache)
      $module_cache_backport_apc_inc              = './sites/all/modules/apc_d7/drupal_apc_cache.inc';
      $module_cache_backport_memcache             = TRUE;  // set TRUE to enable Memcache (MemCacheDrupal)
      $module_cache_backport_memcache_inc         = './sites/all/modules/memcache_d7/memcache.inc';
      $module_cache_backport_memcache_db          = FALSE; // do not use yet
      $module_cache_backport_memcache_db_inc      = './sites/all/modules/memcache_d7/memcache.db.inc';
      $module_cache_backport_memcache_session     = FALSE; // do not use yet
      $module_cache_backport_memcache_session_inc = './sites/all/modules/memcache_d7/memcache-session.inc';
      // Load Include files
      if ( file_exists($module_cache_backport_inc) ) $conf['cache_inc'] = $module_cache_backport_inc;
      if ( $module_cache_backport_database == TRUE ) if ( file_exists($module_cache_backport_database_inc) ) $conf['cache_backends'][] = $module_cache_backport_database_inc;
      if ( $module_cache_backport_filecache == TRUE ) if ( file_exists($module_cache_backport_filecache_inc) ) $conf['cache_backends'][] = $module_cache_backport_filecache_inc;
      if ( $module_cache_backport_apc == TRUE ) if ( file_exists($module_cache_backport_apc_inc) ) $conf['cache_backends'][] = $module_cache_backport_apc_inc;
      if ( $module_cache_backport_memcache == TRUE ) if ( file_exists($module_cache_backport_memcache_inc) ) $conf['cache_backends'][] = $module_cache_backport_memcache_inc;
      if ( $module_cache_backport_memcache_database == TRUE ) if ( file_exists($module_cache_backport_memcache_database_inc) ) $conf['cache_backends'][] = $module_cache_backport_memcache_database_inc;
      if ( $module_cache_backport_memcache_session == TRUE ) if ( file_exists($module_cache_backport_memcache_session_inc) ) $conf['session_inc'] = $module_cache_backport_memcache_session_inc;
      // Define cache bins (optimized):
      $conf['cache_default_class']    = 'DrupalDatabaseCache'; // default, any/any/any, select memcache, apc, file or db
      //$conf['cache_class_bootstrap']  = 'DrupalAPCCache';      // bootstrap, all/every/medium, select apc > db
      $conf['cache_class_block']      = 'MemCacheDrupal';      // block, any/often/small, select memcache > db > file
      $conf['cache_class_cache']      = 'DrupalAPCCache';      // general, all/every/medium, select apc > db
      $conf['cache_class_content']    = 'DrupalFileCache';     // field, page/some/large, select file > memcache > db
      $conf['cache_class_filter']     = 'DrupalFileCache';     // filtered, page/some/large, select file > memcache > db
      $conf['cache_class_form']       = 'DrupalFileCache';     // block, edit/rare/medium, select file > memcache > db
      $conf['cache_class_menu']       = 'MemCacheDrupal';      // menu, any/often/large, select memcache > db > file
      $conf['cache_class_page']       = 'MemCacheDrupal';      // node, page/often/large, select memcache > file > db
      //$conf['cache_class_pathdst']    = 'MemCacheDrupal';      // path, any/some/medium, select memcache > db > file
      //$conf['cache_class_pathsrc']    = 'MemCacheDrupal';      // path, any/some/medium, select memcache > db > file
      //$conf['cache_class_uc_price']   = 'MemCacheDrupal';      // multiprice, any/often/medium, select memcache > db > file
      //$conf['cache_class_session']    = 'MemCacheDrupal';      // session, any/any/small, select memcache > db
      $conf['cache_class_update']     = 'DrupalFileCache';     // system, system/rare/large, select file > db
      //$conf['cache_class_users']      = 'MemCacheDrupal';      // users, any/some/large, select memcache > file > db
      $conf['cache_class_views']      = 'MemCacheDrupal';      // views, any/some/large, select memcache > file > db
      $conf['cache_class_views_data'] = 'DrupalAPCCache';      // views data, any/often/small, select apc > db
      // Define File Cache settings
      $conf['filecache_fast_pagecache'] = TRUE; // set TRUE to enable fast page serving
      $conf['filecache_directory'] = './sites/' . $module_cache_backport_domain . '/files/filecache';
      // Define APC settings
      $conf['apc_show_debug'] = FALSE; // set TRUE to enable debug mode
      // Define Memcache settings
      /*$conf['memcache_options'] = array(
        Memcached::OPT_BINARY_PROTOCOL => FALSE, // set TRUE to enable binary protocol when using memcached >= 1.4
        Memcached::OPT_COMPRESSION => FALSE, // set FALSE to disable compression for improved performance
        Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT, // set consistent distribution
        Memcached::OPT_HASH => Memcached::HASH_CRC, // set CRC32 hash method
        Memcached::OPT_CONNECT_TIMEOUT => 1000, // connection timeout in milliseconds
        Memcached::OPT_SERVER_FAILURE_LIMIT => 5, // failure limit for server connection attempts
      );*/
      $conf['memcache_servers'] = array(
        '127.0.0.1:11211' => 'default',
      );
      $conf['memcache_bins'] = array(
        'cache' => 'default',
        'cache_block' => 'default',
        //'cache_bootstrap' => 'default',
        'cache_content' => 'default',
        'cache_filter' => 'default',
        'cache_form' => 'default',
        'cache_menu' => 'default',
        'cache_page' => 'default',
        //'cache_pathdst' => 'default',
        //'cache_pathsrc' => 'default',
        //'cache_uc_price' => 'default',
        'cache_update' => 'default',
        'cache_views' => 'default',
        'cache_views_data' => 'default',
        //'session' => 'default',
        //'users' => 'default',
      );
      // Define Drupal cache settings:
      $conf['page_cache_without_database'] = TRUE;  // set TRUE to skip starting the database (first define 'cache_page' bin)
      $conf['page_cache_invoke_hooks']     = FALSE; // set FALSE to not use aggressive caching
      $conf['page_cache_maximum_age']      = $variables['page_cache_maximum_age'];
      $conf['cache_lifetime']              = $variables['cache_lifetime'];
      $conf['page_compression']            = $variables['page_compression'];
    }

    Title:suggestions for settings.php + Working Cache APIs/backendsWrite a better documentation and sample settings file

    Changing the issue title to fit the real task to do here.