You are here

function _memcache_storage_memcached_cache_bins in Memcache Storage 7

Helper function that returns a list of cache bins stored in memcached.

3 calls to _memcache_storage_memcached_cache_bins()
memcache_storage_flush_all_cache in ./memcache_storage.module
Flushes all cached bins in memcached pool.
memcache_storage_settings_form in ./memcache_storage.admin.inc
Settings form.
memcache_storage_wildcard_flush in ./memcache_storage.module
Invalidates all cache which should be invalid because of wildcard flushes.

File

./memcache_storage.module, line 284
Provides hook implementation for Memcache Storage module.

Code

function _memcache_storage_memcached_cache_bins() {

  // Load all cache bins available for flushing.
  $available_bins = array();
  $schema = drupal_get_complete_schema();
  foreach ($schema as $table_name => $table_data) {
    if (strpos($table_name, 'cache') === 0) {

      // Make sure that cache controlled for the current cache bin
      // is Memcache Storage.
      $cache_class = variable_get('cache_class_' . $table_name);
      if (!isset($cache_class)) {
        $cache_class = variable_get('cache_default_class', 'DrupalDatabaseCache');
      }
      if ($cache_class == 'MemcacheStorage') {
        $available_bins[$table_name] = $table_name;
      }
    }
  }
  ksort($available_bins);

  // Don't allow to flush form and updates cache, because it's actually not a
  // "flushable" cache and should be stored in database.
  unset($available_bins['cache_form']);
  unset($available_bins['cache_update']);

  // We can't flush cached pages if enabled external page cache.
  // Otherwise it will change memcache key prefix and external server won't find cached pages.
  $external_page_cache = variable_get('memcache_storage_external_page_cache', FALSE);
  if ($external_page_cache) {
    unset($available_bins['cache_page']);
  }
  return $available_bins;
}