first import
This commit is contained in:
39
sites/all/modules/ctools/plugins/cache/export_ui.inc
vendored
Normal file
39
sites/all/modules/ctools/plugins/cache/export_ui.inc
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* A caching mechanism for use with subsystems that use the export ui.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
// cache plugins are the rare plugin types that have no real UI but
|
||||
// we're providing a title just in case.
|
||||
'title' => t('Export UI wizard cache'),
|
||||
'cache get' => 'ctools_cache_export_ui_cache_get',
|
||||
'cache set' => 'ctools_cache_export_ui_cache_set',
|
||||
// Some operations use a 'finalize' but that really just means set
|
||||
// for us, since we're not using temporary storage for subsystems.
|
||||
'cache finalize' => 'ctools_cache_export_ui_cache_set',
|
||||
);
|
||||
|
||||
function ctools_cache_export_ui_cache_get($plugin_name, $key) {
|
||||
ctools_include('export-ui');
|
||||
$plugin = ctools_get_export_ui($plugin_name);
|
||||
$handler = ctools_export_ui_get_handler($plugin);
|
||||
if ($handler) {
|
||||
$item = $handler->edit_cache_get($key);
|
||||
if (!$item) {
|
||||
$item = ctools_export_crud_load($handler->plugin['schema'], $key);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
function ctools_cache_export_ui_cache_set($plugin_name, $key, $item) {
|
||||
ctools_include('export-ui');
|
||||
$plugin = ctools_get_export_ui($plugin_name);
|
||||
$handler = ctools_export_ui_get_handler($plugin);
|
||||
if ($handler) {
|
||||
return $handler->edit_cache_set_key($item, $key);
|
||||
}
|
||||
}
|
51
sites/all/modules/ctools/plugins/cache/simple.inc
vendored
Normal file
51
sites/all/modules/ctools/plugins/cache/simple.inc
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* A simple cache indirection mechanism that just uses the basic object cache.
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
// cache plugins are the rare plugin types that have no real UI but
|
||||
// we're providing a title just in case.
|
||||
'title' => t('Simple'),
|
||||
'cache get' => 'ctools_cache_simple_cache_get',
|
||||
'cache set' => 'ctools_cache_simple_cache_set',
|
||||
'cache clear' => 'ctools_cache_simple_cache_clear',
|
||||
);
|
||||
|
||||
function ctools_cache_simple_cache_get($data, $key) {
|
||||
ctools_include('object-cache');
|
||||
|
||||
// Ensure that if there is somehow no data, we at least don't stomp on other
|
||||
// people's caches.
|
||||
if (empty($data)) {
|
||||
$data = 'simple_cache_plugin';
|
||||
}
|
||||
|
||||
return ctools_object_cache_get($data, $key);
|
||||
}
|
||||
|
||||
function ctools_cache_simple_cache_set($data, $key, $object) {
|
||||
ctools_include('object-cache');
|
||||
|
||||
// Ensure that if there is somehow no data, we at least don't stomp on other
|
||||
// people's caches.
|
||||
if (empty($data)) {
|
||||
$data = 'simple_cache_plugin';
|
||||
}
|
||||
|
||||
return ctools_object_cache_set($data, $key, $object);
|
||||
}
|
||||
|
||||
function ctools_cache_simple_cache_clear($data, $key) {
|
||||
ctools_include('object-cache');
|
||||
|
||||
// Ensure that if there is somehow no data, we at least don't stomp on other
|
||||
// people's caches.
|
||||
if (empty($data)) {
|
||||
$data = 'simple_cache_plugin';
|
||||
}
|
||||
|
||||
return ctools_object_cache_clear($data, $key);
|
||||
}
|
Reference in New Issue
Block a user