You are here

function apdqc_views_get_unpack_options in Asynchronous Prefetch Database Query Cache 7

Prefetch unpack_options & return some cache_views cids to prefetch.

Return value

array Multidimensional array containing tables and cache keys to prefectch.

3 calls to apdqc_views_get_unpack_options()
apdqc_ctools_plugin_pre_alter in ./apdqc.module
Implements hook_ctools_plugin_pre_alter().
apdqc_init in ./apdqc.module
Implements hook_init().
apdqc_menu_get_item_alter in ./apdqc.module
Implements hook_menu_get_item_alter().

File

./apdqc.module, line 925
Asynchronous Prefetch Database Query Cache module.

Code

function apdqc_views_get_unpack_options() {
  if (!function_exists('apdqc_run_prefetch_array') || !function_exists('apdqc_escape_string')) {
    return array();
  }
  static $run_once;
  $table_keys_cache_prefetch = array();
  if (!isset($run_once)) {
    $run_once = TRUE;
    if (apdqc_get_bin_class_name('cache_views') !== 'APDQCache') {
      return;
    }
    $lang_shorthand = apdqc_get_lang();
    if (variable_get('apdqc_prefetch_views_unpack', APDQC_PREFETCH_VIEWS_UNPACK)) {

      // Prefetch cache; OR with a LIKE % results in slow queries.
      $table_keys_cache_prefetch['cache_views'][] = 'unpack_options:%:' . $lang_shorthand;
      apdqc_run_prefetch_array($table_keys_cache_prefetch);
      $table_keys_cache_prefetch = array();
    }
    $table_keys_cache_prefetch['cache_views'][] = 'views_data:node:' . $lang_shorthand;
    $table_keys_cache_prefetch['cache_views'][] = 'views_data:' . $lang_shorthand;
  }
  return $table_keys_cache_prefetch;
}