You are here

function views_content_cache_get_plugin in Views content cache 6.2

Same name and namespace in other branches
  1. 7.3 views_content_cache.module \views_content_cache_get_plugin()

Retrieve a plugin object.

Parameters

string $plugin: The name of the plugin class to retrieve. Optional.

boolean $reset: Reset the static cache.

Return value

mixed If a specific plugin class was requested an instance of that class is returned. Otherwise, an array of all plugins.

5 calls to views_content_cache_get_plugin()
views_content_cache_and_or_key_get in ./views_content_cache.module
Determine how this cache segment should be combined with others.
views_content_cache_id_generate in ./views_content_cache.module
Generate one or more cache ids for an update record.
views_content_cache_id_schema in ./views_content_cache.module
Retrieve or generate the cache id to schema mapping.
views_content_cache_plugin_cache::cache_expire in views/views_content_cache_plugin_cache.inc
Return the expiry time for this cache plugin.
views_content_cache_plugin_cache::options_form in views/views_content_cache_plugin_cache.inc

File

./views_content_cache.module, line 352
Views content cache cache.

Code

function views_content_cache_get_plugin($plugin = NULL, $reset = FALSE) {
  static $cache;
  if (!isset($cache) || $reset) {
    ctools_include('plugins');
    $plugins = ctools_get_plugins('views_content_cache', 'plugins');

    // This ksort is critical. This ensures that our plugins are in consistent
    // order, especially important for views_content_cache_id_schema().
    ksort($plugins);
    foreach ($plugins as $key => $info) {
      if (empty($info['abstract']) && ($class = ctools_plugin_get_class($info, 'handler'))) {
        $cache[$key] = new $class();
      }
    }
  }
  if (isset($plugin)) {
    return isset($cache[$plugin]) ? $cache[$plugin] : FALSE;
  }
  return $cache;
}