本文整理汇总了PHP中FileCache::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP FileCache::fetch方法的具体用法?PHP FileCache::fetch怎么用?PHP FileCache::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileCache
的用法示例。
在下文中一共展示了FileCache::fetch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($search_paths = array())
{
$this->paths = $search_paths;
$this->modules = $this->getModules();
if (FileCache::is_cached('modules_info', 180)) {
// cache expire after 3 mins
$this->modules_info = FileCache::fetch('modules_info', null, 180);
} else {
$this->modules_info = array();
$this->getCNModulesInfo();
FileCache::store('modules_info', $this->modules_info, 180);
}
}
示例2: unserialize
// check has a module the appropriate method with this name to handle action
// for example: if form action = "/cndynamic.php?page_id=7&action=AddGroupSubmit"
// name of this method will be: handleAddGroupSubmit
if (method_exists($obj, $handler_function)) {
$obj->{$handler_function}($app->request_method, $app->getRequestData());
}
}
}
global $use_theme;
// Theme name defined in page XML config file
try {
$save_page = $app->getRequestParam('save');
$new_page_settings = $app->getRequestParam('page_settings') ? unserialize(urldecode($app->getRequestParam('page_settings'))) : null;
$cache_id = "dyn_page_{$req_page}";
if (FileCache::is_cached($cache_id)) {
$dynamic_page = FileCache::fetch($cache_id);
$page_settings = $dynamic_page->buildPageSettings($new_page_settings);
} else {
$dynamic_page = new CNDynamicPage($req_page);
$dynamic_page->initialize();
$dynamic_page->save_page = $save_page;
$page_settings = $dynamic_page->buildPageSettings($new_page_settings);
FileCache::store($cache_id, $dynamic_page, 1200);
}
// Force login if we're on a private network, unless we're on login.php, register.php or cnuser_login_index.php
$login_required = $page_settings['page_mode'] != 'public' ? true : false;
if (!$login_required && PA::$network_info->is_private() && !$login_never_required) {
$login_required = TRUE;
}
// Check user session / login status, and redirect to login page (or
// request page, for private networks) if required.
示例3: get_pages_default_setting
/**
* Generic Function to get record from page settings table
* Function will take the field_name and value in the form of key => value pair
*/
public static function get_pages_default_setting($page_type, $only_configurable = true, $from_XML = false)
{
global $app;
Logger::log('Enter: function ModuleSetting::get_pages_default_setting');
if (FileCache::is_cached($page_type . '_module_default_setting')) {
$settings = FileCache::fetch($page_type . '_module_default_setting');
return $settings;
} else {
$return = array();
$results = $app->configObj->query("//*[@section='pages' and contains(@page_type, '{$page_type}')]");
//echo "Results:<pre>" . print_r($results, 1). "</pre>"; die();
// $pages = array_flip(getConstantsByPrefix('PAGE_')); // function defined in helper_functions.php
// foreach($pages as $key => $const_name) {
foreach ($results as $const_name => $key) {
if (is_numeric($key)) {
$page_settings = self::load_setting($key, PA::$network_info->network_id, $page_type, null, $only_configurable);
if ($page_settings) {
$cache_id = "dyn_page_{$key}";
if (FileCache::is_cached($cache_id)) {
$dynamic_page = FileCache::fetch($cache_id);
} else {
$dynamic_page = new DynamicPage($key);
FileCache::store($cache_id, $dynamic_page, 1200);
}
if (!is_object($dynamic_page) or !$dynamic_page->docLoaded) {
throw new Exception("Page XML config file for page ID: {$page_id} - not found!");
}
$dynamic_page->initialize();
if (!$from_XML) {
foreach ($page_settings as $section => $value) {
$dynamic_page->{$section} = $value;
}
}
// also return the api_id
$dynamic_page->api_id = strtolower(preg_replace("/^PAGE_/", '', $const_name));
$return[] = $dynamic_page;
}
}
}
FileCache::store($page_type . '_module_default_setting', $return, 1200);
}
Logger::log('Exit: function ModuleSetting::get_pages_default_setting');
return $return;
}