annotate sites/all/modules/ctools/plugins/cache/simple.inc @ 9:830c812b520f

added smtp module
author root <root@paio.local>
date Mon, 28 Oct 2013 15:34:27 +0000
parents ff03f76ab3fe
children
rev   line source
danielebarchiesi@0 1 <?php
danielebarchiesi@0 2
danielebarchiesi@0 3 /**
danielebarchiesi@0 4 * @file
danielebarchiesi@0 5 * A simple cache indirection mechanism that just uses the basic object cache.
danielebarchiesi@0 6 */
danielebarchiesi@0 7
danielebarchiesi@0 8 $plugin = array(
danielebarchiesi@0 9 // cache plugins are the rare plugin types that have no real UI but
danielebarchiesi@0 10 // we're providing a title just in case.
danielebarchiesi@0 11 'title' => t('Simple'),
danielebarchiesi@0 12 'cache get' => 'ctools_cache_simple_cache_get',
danielebarchiesi@0 13 'cache set' => 'ctools_cache_simple_cache_set',
danielebarchiesi@0 14 'cache clear' => 'ctools_cache_simple_cache_clear',
danielebarchiesi@0 15 );
danielebarchiesi@0 16
danielebarchiesi@0 17 function ctools_cache_simple_cache_get($data, $key) {
danielebarchiesi@0 18 ctools_include('object-cache');
danielebarchiesi@0 19
danielebarchiesi@0 20 // Ensure that if there is somehow no data, we at least don't stomp on other
danielebarchiesi@0 21 // people's caches.
danielebarchiesi@0 22 if (empty($data)) {
danielebarchiesi@0 23 $data = 'simple_cache_plugin';
danielebarchiesi@0 24 }
danielebarchiesi@0 25
danielebarchiesi@0 26 return ctools_object_cache_get($data, $key);
danielebarchiesi@0 27 }
danielebarchiesi@0 28
danielebarchiesi@0 29 function ctools_cache_simple_cache_set($data, $key, $object) {
danielebarchiesi@0 30 ctools_include('object-cache');
danielebarchiesi@0 31
danielebarchiesi@0 32 // Ensure that if there is somehow no data, we at least don't stomp on other
danielebarchiesi@0 33 // people's caches.
danielebarchiesi@0 34 if (empty($data)) {
danielebarchiesi@0 35 $data = 'simple_cache_plugin';
danielebarchiesi@0 36 }
danielebarchiesi@0 37
danielebarchiesi@0 38 return ctools_object_cache_set($data, $key, $object);
danielebarchiesi@0 39 }
danielebarchiesi@0 40
danielebarchiesi@0 41 function ctools_cache_simple_cache_clear($data, $key) {
danielebarchiesi@0 42 ctools_include('object-cache');
danielebarchiesi@0 43
danielebarchiesi@0 44 // Ensure that if there is somehow no data, we at least don't stomp on other
danielebarchiesi@0 45 // people's caches.
danielebarchiesi@0 46 if (empty($data)) {
danielebarchiesi@0 47 $data = 'simple_cache_plugin';
danielebarchiesi@0 48 }
danielebarchiesi@0 49
danielebarchiesi@0 50 return ctools_object_cache_clear($data, $key);
danielebarchiesi@0 51 }