simple.inc
1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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);
}