Definition in file cache.inc.
Go to the source code of this file.
Functions | |
| _views_include_handlers () | |
| Load views files on behalf of modules. | |
| _views_include_default_views () | |
| Load default views files on behalf of modules. | |
| _views_fetch_data ($table=NULL) | |
| Fetch Views' data from the cache. | |
| _views_fetch_plugin_data ($type=NULL, $plugin=NULL) | |
| Fetch the plugin data from cache. | |
| _views_discover_default_views () | |
| Scan all modules for default views and rebuild the default views cache. | |
| views_cache_set ($cid, $data, $use_language=FALSE) | |
| Set a cached item in the views cache. | |
| views_cache_get ($cid, $use_language=FALSE) | |
| Return data from the persistent views cache. | |
| views_object_cache_get ($obj, $name, $skip_cache=FALSE) | |
| Get an object from the non-volatile Views cache. | |
| views_object_cache_set ($obj, $name, $cache) | |
| Store an object in the non-volatile Views cache. | |
| views_object_cache_clear ($obj, $name) | |
| Remove an object from the non-volatile Views cache. | |
| views_object_cache_clean ($age=NULL) | |
| Remove all objects in the object cache that are older than the specified age. | |
| _views_discover_default_views | ( | ) |
Scan all modules for default views and rebuild the default views cache.
Definition at line 99 of file cache.inc.
References $name, views_cache_get(), and views_cache_set().
00099 { 00100 static $cache = NULL; 00101 00102 if (!isset($cache)) { 00103 $data = views_cache_get('views_default_views', TRUE); 00104 00105 if (isset($data->data) && is_array($data->data)) { 00106 $cache = $data->data; 00107 } 00108 else { 00109 views_include_default_views(); 00110 $defaults = module_invoke_all('views_default_views'); 00111 $cache = array(); 00112 00113 foreach ($defaults as $name => $view) { 00114 // Only views with a sufficiently high api version are eligible. 00115 if (isset($view->api_version) && $view->api_version >= 2) { 00116 // Do not cache dead handlers. 00117 $view->destroy(); 00118 $cache[$name] = $view; 00119 } 00120 } 00121 00122 // Allow modules to modify default views before they are cached. 00123 drupal_alter('views_default_views', $cache); 00124 00125 views_cache_set('views_default_views', $cache, TRUE); 00126 } 00127 } 00128 00129 return $cache; 00130 }
| _views_fetch_data | ( | $ | table = NULL |
) |
Fetch Views' data from the cache.
Definition at line 27 of file cache.inc.
References views_cache_get(), and views_cache_set().
00027 { 00028 static $cache = NULL; 00029 if (!isset($cache)) { 00030 $start = views_microtime(); 00031 // NOTE: This happens whether we retrieve them from cache or otherwise. 00032 views_include_handlers(); 00033 00034 $data = views_cache_get('views_data', TRUE); 00035 if (!empty($data->data)) { 00036 $cache = $data->data; 00037 } 00038 00039 if (empty($cache)) { 00040 $cache = module_invoke_all('views_data'); 00041 foreach (module_implements('views_data_alter') as $module) { 00042 $function = $module . '_views_data_alter'; 00043 $function($cache); 00044 } 00045 00046 views_cache_set('views_data', $cache, TRUE); 00047 } 00048 00049 vpr('Views data build time: ' . (views_microtime() - $start) * 1000 . ' ms'); 00050 } 00051 00052 if (!$table) { 00053 return $cache; 00054 } 00055 if (isset($cache[$table])) { 00056 return $cache[$table]; 00057 } 00058 00059 // Return an empty array if there is no match. 00060 return array(); 00061 }
| _views_fetch_plugin_data | ( | $ | type = NULL, |
|
| $ | plugin = NULL | |||
| ) |
Fetch the plugin data from cache.
Definition at line 66 of file cache.inc.
References views_discover_plugins().
00066 { 00067 static $cache = NULL; 00068 if (!isset($cache)) { 00069 $start = views_microtime(); 00070 views_include_handlers(); 00071 00072 $cache = views_discover_plugins(); 00073 00074 vpr('Views plugins build time: ' . (views_microtime() - $start) * 1000 . ' ms'); 00075 } 00076 00077 if (!$type && !$plugin) { 00078 return $cache; 00079 } 00080 else if (!$plugin) { 00081 // Not in the if above so the else below won't run 00082 if (isset($cache[$type])) { 00083 return $cache[$type]; 00084 } 00085 } 00086 else if (isset($cache[$type][$plugin])) { 00087 return $cache[$type][$plugin]; 00088 } 00089 00090 // Return an empty array if there is no match. 00091 return array(); 00092 }
| _views_include_default_views | ( | ) |
| _views_include_handlers | ( | ) |
| views_cache_get | ( | $ | cid, | |
| $ | use_language = FALSE | |||
| ) |
Return data from the persistent views cache.
This is just a convenience wrapper around cache_get().
| $cid | The cache ID of the data to retrieve. | |
| $use_language | If TRUE, the data will be requested specific to the currently active language. |
Definition at line 168 of file cache.inc.
Referenced by _views_discover_default_views(), and _views_fetch_data().
00168 { 00169 global $language; 00170 00171 if (variable_get('views_skip_cache', FALSE)) { 00172 return 0; 00173 } 00174 if ($use_language) { 00175 $cid .= ':' . $language->language; 00176 } 00177 00178 return cache_get($cid, 'cache_views'); 00179 }
| views_cache_set | ( | $ | cid, | |
| $ | data, | |||
| $ | use_language = FALSE | |||
| ) |
Set a cached item in the views cache.
This is just a convenience wrapper around cache_set().
| $cid | The cache ID of the data to store. | |
| $data | The data to store in the cache. Complex data types will be automatically serialized before insertion. Strings will be stored as plain text and not serialized. | |
| $use_language | If TRUE, the data will be cached specific to the currently active language. |
Definition at line 145 of file cache.inc.
Referenced by _views_discover_default_views(), and _views_fetch_data().
00145 { 00146 global $language; 00147 00148 if (variable_get('views_skip_cache', FALSE)) { 00149 return; 00150 } 00151 if ($use_language) { 00152 $cid .= ':' . $language->language; 00153 } 00154 00155 cache_set($cid, $data, 'cache_views'); 00156 }
1.4.7