123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <?php
- function ctools_cache_get($mechanism, $key) {
- return ctools_cache_operation($mechanism, $key, 'get');
- }
- function ctools_cache_set($mechanism, $key, $object) {
- return ctools_cache_operation($mechanism, $key, 'set', $object);
- }
- function ctools_cache_clear($mechanism, $key) {
- return ctools_cache_operation($mechanism, $key, 'clear');
- }
- function ctools_cache_operation($mechanism, $key, $op, $object = NULL) {
- list($plugin, $data) = ctools_cache_find_plugin($mechanism);
- if (empty($plugin)) {
- return;
- }
- $function = ctools_plugin_get_function($plugin, "cache $op");
- if (empty($function)) {
- return;
- }
- return $function($data, $key, $object, $op);
- }
- function ctools_cache_find_plugin($mechanism) {
- if (strpos($mechanism, '::') !== FALSE) {
-
-
- list($name, $data) = explode('::', $mechanism, 2);
- }
- else {
- $name = $mechanism;
- $data = '';
- }
- if (empty($name)) {
- return array(NULL, $data);
- }
- ctools_include('plugins');
- $plugin = ctools_get_plugins('ctools', 'cache', $name);
- return array($plugin, $data);
- }
|