function cache_actions_rules_cache_get_id in Cache Actions 7.2
Same name and namespace in other branches
- 6.2 plugins/cache/rules.inc \cache_actions_rules_cache_get_id()
- 7 plugins/cache/rules.inc \cache_actions_rules_cache_get_id()
Figure out an id for our cache based upon input and settings.
2 calls to cache_actions_rules_cache_get_id()
- cache_actions_rules_cache_get_cache in plugins/
cache/ rules.inc - Get cached content.
- cache_actions_rules_cache_set_cache in plugins/
cache/ rules.inc - Set cached content.
File
- plugins/
cache/ rules.inc, line 96 - Provides a simple time-based caching option for panel panes.
Code
function cache_actions_rules_cache_get_id($conf, $display, $args, $contexts, $pane) {
$id = $conf['cache_key'];
if (!empty($display->context) && !empty($conf['substitute'])) {
$id = ctools_context_keyword_substitute($id, array(), $display->context);
}
if (user_access('view pane admin links')) {
$id .= ':adm';
}
switch ($conf['granularity']) {
case 'args':
foreach ($args as $arg) {
// Arguments can be many things, but we only consider the ones that are
// string values.
if (is_string($arg)) {
$id .= ':' . $arg;
}
}
break;
case 'context':
if (!is_array($contexts)) {
$contexts = array(
$contexts,
);
}
foreach ($contexts as $context) {
if (isset($context->argument)) {
$id .= ':' . $context->argument;
}
}
break;
}
// Add cache for individual language.
if ($conf['language']) {
global $language;
$id .= ':' . $language->language;
}
// Add cache for individual content language.
if (!empty($conf['language_content'])) {
global $language_content;
$id .= ':' . $language_content->language;
}
$cache = new stdClass();
$cache->conf = $conf;
$cache->display = $display;
$cache->args = $args;
$cache->contexts = $contexts;
$cache->pane = $pane;
$cache->key = $id;
// Let other modules alter the cache key.
drupal_alter('cache_actions_panels_cache_key', $cache);
return $cache->key;
}