当前位置: 首页>>代码示例>>PHP>>正文


PHP cache::set方法代码示例

本文整理汇总了PHP中cache::set方法的典型用法代码示例。如果您正苦于以下问题:PHP cache::set方法的具体用法?PHP cache::set怎么用?PHP cache::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cache的用法示例。


在下文中一共展示了cache::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 private static function init()
 {
     if (self::$keys == '') {
         if (!(self::$keys = cache::get('global-settings'))) {
             $sql = 'SELECT SQL_CACHE r_id id, r_section_id section, r_key name, r_value value, r_description description FROM <<register>>;';
             self::$keys = db::q($sql, records);
             if (db::issetError()) {
                 die;
             }
             // Записываем в кэш
             cache::set('global-settings', self::$keys);
         }
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:14,代码来源:reg.php

示例2: _accessToken

 private function _accessToken()
 {
     require_once 'class.cacheFile.php';
     $cache = new cache();
     $access_token = $cache->get('access_token');
     if ($access_token === NULL) {
         $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . APPID . "&secret=" . AppSecrect;
         $status = $this->_httpRequest($url);
         $status = json_decode($status, true);
         //将对象转为数组
         $access_token = $status['access_token'];
         $cache->set('access_token', $access_token, 7200);
     }
     return $access_token;
 }
开发者ID:tangyouyou,项目名称:WeiXin,代码行数:15,代码来源:class.weixin.php

示例3: useResultCache

 public function useResultCache($timeout = 30, $params = null)
 {
     $cachekey = 'TinyORM-' . md5($this->sql);
     if ($params) {
         $cachekey .= md5(serialize($params));
     }
     $cached = cache::get($cachekey);
     if ($cached === false) {
         $query = $this->connection->prepare($this->sql);
         $query->execute($params);
         $cached = $query->fetchAll();
         cache::set($cachekey, $cached, $timeout);
     }
     return $cached;
 }
开发者ID:cagataygurturk,项目名称:tinyorm,代码行数:15,代码来源:Query.php

示例4: init

    /**
     * Initializing i18n
     *
     * @param array $options
     */
    public static function init($options = [])
    {
        do {
            self::$language_code = $options['language_code'];
            $where = " AND lc_translation_language_code = '{$options['language_code']}'";
            // retrive data from cache
            $cache_id_file = $cache_id = 'numbers_backend_i18n_basic_base_' . $options['language_code'];
            // if we are including js translations
            if (strpos($_SERVER['REQUEST_URI'] ?? '', $cache_id_file . '.js') !== false) {
                $where .= " AND lc_translation_javascript = 1";
                $cache_id .= '_js';
            }
            $cache = new cache();
            $data = $cache->get($cache_id);
            if ($data !== false) {
                self::$data = !empty($data) ? $data : ['ids' => [], 'hashes' => []];
                break;
            }
            // load data from database
            $sql = <<<TTT
\t\t\t\tSELECT
\t\t\t\t\tlc_translation_id id,
\t\t\t\t\tlc_translation_text_sys sys,
\t\t\t\t\tlc_translation_text_new new
\t\t\t\tFROM lc_translations
\t\t\t\tWHERE 1=1
\t\t\t\t\t{$where}
TTT;
            $query_result = factory::model('numbers_backend_i18n_basic_model_translations')->db_object->query($sql);
            foreach ($query_result['rows'] as $k => $v) {
                if (strlen($v['sys']) > 40) {
                    $v['sys'] = sha1($v['sys']);
                }
                self::$data['hashes'][$v['sys']] = $v['new'];
                self::$data['ids'][$v['id']] = $v['sys'];
            }
            // set the cache
            $cache->set($cache_id, self::$data, ['translations']);
        } while (0);
        // load js
        numbers_frontend_media_libraries_jssha_base::add();
        layout::add_js('/numbers/media_submodules/numbers_backend_i18n_basic_media_js_i18n.js', 5001);
        layout::add_js('/numbers/backend/i18n/basic/controller/javascript/_js/' . $cache_id_file . '.js', 50000);
        // load data into cache
        return ['success' => 1, 'error' => []];
    }
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:51,代码来源:base.php

示例5: tweets

function tweets($username, $params = array())
{
    $defaults = array('limit' => 10, 'cache' => true, 'refresh' => 60 * 20);
    // add the username to the defaults array
    $defaults['username'] = $username;
    $options = array_merge($defaults, $params);
    // check the cache dir
    $cacheDir = c::get('root.cache') . '/tweets';
    dir::make($cacheDir);
    // disable the cache if adding the cache dir failed
    if (!is_dir($cacheDir) || !is_writable($cacheDir)) {
        $options['cache'] = false;
    }
    // sanitize the limit
    if ($options['limit'] > 200) {
        $options['limit'] = 200;
    }
    // generate a unique cache ID
    $cacheID = 'tweets/tweets.' . md5($options['username']) . '.' . $options['limit'] . '.php';
    if ($options['cache']) {
        $cache = cache::modified($cacheID) < time() - $options['refresh'] ? false : cache::get($cacheID);
    } else {
        $cache = false;
    }
    if (!empty($cache)) {
        return $cache;
    }
    $url = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=' . $options['username'] . '&count=' . $options['limit'];
    $json = @file_get_contents($url);
    $data = str::parse($json);
    if (!$data) {
        return false;
    }
    $result = array();
    foreach ($data as $tweet) {
        $user = $tweet['user'];
        $result[] = new tweet(array('url' => 'http://twitter.com/' . $options['username'] . '/status/' . $tweet['id_str'], 'text' => $tweet['text'], 'date' => strtotime($tweet['created_at']), 'source' => $tweet['source'], 'user' => new obj(array('name' => $user['name'], 'bio' => $user['description'], 'username' => $user['screen_name'], 'url' => 'http://twitter.com/' . $user['screen_name'], 'image' => 'http://twitter.com/api/users/profile_image/' . $user['screen_name'], 'following' => $user['friends_count'], 'followers' => $user['followers_count']))));
    }
    $result = new obj($result);
    if ($options['cache']) {
        cache::set($cacheID, $result);
    }
    return $result;
}
开发者ID:nilshendriks,项目名称:kirbycms-extensions,代码行数:44,代码来源:tweets.php

示例6: init

 static function init()
 {
     if (isset($_SESSION['curUser']['name']) && $_SESSION['curUser']['name'] != 'none') {
         self::$isGuest = false;
         self::$isAdmin = $_SESSION['curUser']['isAdmin'];
         $key = 'user' . $_SESSION['curUser']['id'];
         if (!(self::$obj = cache::get($key))) {
             self::$obj = ormObjects::get($_SESSION['curUser']['id']);
             // Записываем в кэш
             cache::set($key, self::$obj);
         }
         /*
                     self::$obj->last_visit = date('Y-m-d H:i:s');
                     self::$obj->last_ip = $_SERVER['REMOTE_ADDR'];
         
                     self::$obj->save();    */
         //проверяем наличие кукисов если есть авторизуем
     } else {
         if (isset($_COOKIE['remember_me']) && $_COOKIE['remember_me'] != '') {
             //разбиваем строку по параметрам: 0 - id, 1 - browser hash, 2 - random hash
             $params = explode('-', $_COOKIE["remember_me"]);
             $user = ormObjects::get($params[0], 'user');
             $confirmIP = strpos($user->last_ip, self::getIP(2)) === false;
             if (!$confirmIP && $params[1] == self::browserHash() && $params[2] == $user->remember_me) {
                 self::$obj = $user;
                 self::getRights();
                 self::$isAdmin = count(self::$right) == 0 ? false : true;
                 self::$isGuest = false;
                 self::updateSession($user->id, $user->login, $user->name, $user->email);
                 self::$obj->last_visit = date('Y-m-d H:i:s');
                 self::$obj->last_ip = self::getIP();
                 self::$obj->error_passw = 0;
                 self::$obj->save();
                 system::log(lang::get('ENTER_USER_WITH_COOKIE'), info);
             }
         }
     }
     if (!isset($_SESSION['curUser']['name'])) {
         self::guestCreate();
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:41,代码来源:user.php

示例7: proccessMessageEvent

 public static function proccessMessageEvent($_message)
 {
     switch ($_message->messageSchemeIdentifier()) {
         case 'sensor.basic':
             require_once dirname(__FILE__) . '/schema/sensor.basic.class.php';
             $list_event = basicSensor::parserMessage($_message);
             break;
         default:
             break;
     }
     if (is_array($list_event)) {
         foreach ($list_event as $event) {
             $cmd = xPLCmd::byId($event['cmd_id']);
             if ($cmd->getType() == 'info') {
                 cache::set('xpl' . $cmd->getId(), $event['value']);
             }
             $cmd->event($event['value']);
         }
     }
     return;
 }
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:21,代码来源:xpl.class.php

示例8: get

 /**
  * Get information
  *
  * @param string $ip
  * @return array
  */
 public function get($ip)
 {
     $ip = $ip . '';
     // try to get IP information from cache
     $cache = new cache('db');
     $cache_id = 'misc_ip_ipinfo_' . $ip;
     $data = $cache->get($cache_id);
     if ($data !== false) {
         return ['success' => true, 'error' => [], 'data' => $data];
     }
     // if we need to query ipinfo.io
     $json = file_get_contents("http://ipinfo.io/{$ip}/json");
     $data = json_decode($json, true);
     if (isset($data['country'])) {
         $temp = explode(',', $data['loc']);
         $save = ['ip' => $ip, 'date' => format::now('date'), 'country' => $data['country'], 'region' => $data['region'], 'city' => $data['city'], 'postal' => $data['postal'], 'lat' => format::read_floatval($temp[0]), 'lon' => format::read_floatval($temp[1])];
         $cache->set($cache_id, $save, ['misc_ip_ipinfo'], 604800);
         return ['success' => true, 'error' => [], 'data' => $save];
     } else {
         return ['success' => false, 'error' => ['Could not decode IP address!'], 'data' => ['ip' => $ip]];
     }
 }
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:28,代码来源:base.php

示例9: mod_dashboard

function mod_dashboard()
{
    global $config, $mod;
    $args = array();
    $args['boards'] = listBoards();
    if (hasPermission($config['mod']['noticeboard'])) {
        if (!$config['cache']['enabled'] || !($args['noticeboard'] = cache::get('noticeboard_preview'))) {
            $query = prepare("SELECT ``noticeboard``.*, `username` FROM ``noticeboard`` LEFT JOIN ``mods`` ON ``mods``.`id` = `mod` ORDER BY `id` DESC LIMIT :limit");
            $query->bindValue(':limit', $config['mod']['noticeboard_dashboard'], PDO::PARAM_INT);
            $query->execute() or error(db_error($query));
            $args['noticeboard'] = $query->fetchAll(PDO::FETCH_ASSOC);
            if ($config['cache']['enabled']) {
                cache::set('noticeboard_preview', $args['noticeboard']);
            }
        }
    }
    if (!$config['cache']['enabled'] || ($args['unread_pms'] = cache::get('pm_unreadcount_' . $mod['id'])) === false) {
        $query = prepare('SELECT COUNT(*) FROM ``pms`` WHERE `to` = :id AND `unread` = 1');
        $query->bindValue(':id', $mod['id']);
        $query->execute() or error(db_error($query));
        $args['unread_pms'] = $query->fetchColumn();
        if ($config['cache']['enabled']) {
            cache::set('pm_unreadcount_' . $mod['id'], $args['unread_pms']);
        }
    }
    $query = prepare('SELECT COUNT(*) AS `total_reports` FROM ``reports``' . ($mod["type"] < GLOBALVOLUNTEER ? " WHERE board = :board" : ""));
    if ($mod['type'] < GLOBALVOLUNTEER) {
        $query->bindValue(':board', $mod['boards'][0]);
    } else {
        $query = prepare('SELECT (SELECT COUNT(id) FROM reports WHERE global = 0) AS total_reports, (SELECT COUNT(id) FROM reports WHERE global = 1) AS global_reports');
    }
    $query->execute() or error(db_error($query));
    $row = $query->fetch();
    $args['reports'] = $row['total_reports'];
    $args['global_reports'] = isset($row['global_reports']) ? $row['global_reports'] : false;
    $args['logout_token'] = make_secure_link_token('logout');
    modLog('Looked at dashboard', false);
    mod_page(_('Dashboard'), 'mod/dashboard.html', $args);
}
开发者ID:ringtech,项目名称:infinity,代码行数:39,代码来源:pages.php

示例10: DNS

function DNS($host)
{
    global $config;
    if ($config['cache']['enabled'] && ($ip_addr = cache::get('dns_' . $host))) {
        return $ip_addr != '?' ? $ip_addr : false;
    }
    if (!$config['dns_system']) {
        $ip_addr = gethostbyname($host);
        if ($ip_addr == $host) {
            $ip_addr = false;
        }
    } else {
        $resp = shell_exec_error('host -W 1 ' . $host);
        if (preg_match('/has address ([^\\s]+)$/', $resp, $m)) {
            $ip_addr = $m[1];
        } else {
            $ip_addr = false;
        }
    }
    if ($config['cache']['enabled']) {
        cache::set('dns_' . $host, $ip_addr !== false ? $ip_addr : '?');
    }
    return $ip_addr;
}
开发者ID:Cipherwraith,项目名称:infinity,代码行数:24,代码来源:functions.php

示例11: getUsbMapping

 public static function getUsbMapping($_name = '', $_getGPIO = false)
 {
     $cache = cache::byKey('jeedom::usbMapping');
     if (!is_json($cache->getValue()) || $_name == '') {
         $usbMapping = array();
         foreach (ls('/dev/', 'ttyUSB*') as $usb) {
             $vendor = '';
             $model = '';
             foreach (explode("\n", shell_exec('/sbin/udevadm info --name=/dev/' . $usb . ' --query=all')) as $line) {
                 if (strpos($line, 'E: ID_MODEL=') !== false) {
                     $model = trim(str_replace(array('E: ID_MODEL=', '"'), '', $line));
                 }
                 if (strpos($line, 'E: ID_VENDOR=') !== false) {
                     $vendor = trim(str_replace(array('E: ID_VENDOR=', '"'), '', $line));
                 }
             }
             if ($vendor == '' && $model == '') {
                 $usbMapping['/dev/' . $usb] = '/dev/' . $usb;
             } else {
                 $name = trim($vendor . ' ' . $model);
                 $number = 2;
                 while (isset($usbMapping[$name])) {
                     $name = trim($vendor . ' ' . $model . ' ' . $number);
                     $number++;
                 }
                 $usbMapping[$name] = '/dev/' . $usb;
             }
         }
         if ($_getGPIO) {
             if (file_exists('/dev/ttyAMA0')) {
                 $usbMapping['Raspberry pi'] = '/dev/ttyAMA0';
             }
             if (file_exists('/dev/ttymxc0')) {
                 $usbMapping['Jeedom board'] = '/dev/ttymxc0';
             }
             if (file_exists('/dev/S2')) {
                 $usbMapping['Banana PI'] = '/dev/S2';
             }
             if (file_exists('/dev/ttyS2')) {
                 $usbMapping['Banana PI (2)'] = '/dev/ttyS2';
             }
             if (file_exists('/dev/ttyS0')) {
                 $usbMapping['Cubiboard'] = '/dev/ttyS0';
             }
             foreach (ls('/dev/', 'ttyACM*') as $value) {
                 $usbMapping['/dev/' . $value] = '/dev/' . $value;
             }
         }
         cache::set('jeedom::usbMapping', json_encode($usbMapping), 0);
     } else {
         $usbMapping = json_decode($cache->getValue(), true);
     }
     if ($_name != '') {
         if (isset($usbMapping[$_name])) {
             return $usbMapping[$_name];
         }
         $usbMapping = self::getUsbMapping('', $_getGPIO);
         if (isset($usbMapping[$_name])) {
             return $usbMapping[$_name];
         }
         if (file_exists($_name)) {
             return $_name;
         }
         return '';
     }
     return $usbMapping;
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:67,代码来源:jeedom.class.php

示例12: _clientStyles

	private static function _clientStyles()
	{
		$styles=array();
		$dir=FLEX_APP_DIR_TPL."/".self::$config["template"]."/".self::$class;
		$file=FLEX_APP_DIR."/".$dir."/styles/".self::$class.".css";
		$found=@file_exists($file);
		if(FLEX_APP_DIR_SRC && !$found)
		{
			$file=FLEX_APP_DIR_SRC.".core/".$file;
			$tplDir=FLEX_APP_DIR_ROOT."?feh-rsc-get=auto&path=/".FLEX_APP_DIR."/".$dir."/";
			$found=@file_exists($file);
		}
		else
		{
			$tplDir=FLEX_APP_DIR_ROOT.FLEX_APP_DIR."/".$dir."/";
		}
		$styles[]=array("class"=>self::$class,"ext"=>false,"file"=>$file,"found"=>$found,"name"=>self::$class,"tplDir"=>$tplDir);//ext - external script
		$len=count(self::$clStyles);
		for($cnt=0;$cnt<$len;$cnt++)
		{
			$item=array();
			if(self::$clStyles[$cnt]["http"])continue;
			$item["class"]=self::$clStyles[$cnt]["class"];
			if(self::$clStyles[$cnt]["link"])
			{
				$path=explode("/",self::$clStyles[$cnt]["name"]);
				if(count($path))$name=array_pop($path);
				else $name=self::$clStyles[$cnt]["name"];
				$item["ext"]=false;
				$item["file"]=self::$clStyles[$cnt]["name"];
				$item["found"]=@file_exists($item["file"]);
				$item["name"]=$name;
				$item["tplDir"]=FLEX_APP_DIR_ROOT.implode("/",$path)."/";
			}
			else
			{
				$tpl=(isset(self::$clStyles[$cnt]["tpl"])?self::$clStyles[$cnt]["tpl"]:self::$c->template());
				$core=(isset(self::$clStyles[$cnt]["core"]) && self::$clStyles[$cnt]["core"]);
				$corePath=$core?(FLEX_APP_DIR."/"):"";
				$dir=FLEX_APP_DIR_TPL."/".$tpl."/".self::$clStyles[$cnt]["class"].self::$clStyles[$cnt]["admin"];
				$file=$dir."/styles/".self::$clStyles[$cnt]["name"].".css";
				$found=@file_exists($corePath.$file);
				if(FLEX_APP_DIR_SRC && !$found)
				{
					$file=FLEX_APP_DIR_SRC.($core?(".core/".FLEX_APP_DIR):(".classes/.".self::$clStyles[$cnt]["class"]))."/".$file;
					$tplDir=FLEX_APP_DIR_ROOT."?feh-rsc-get=auto&path=/".$corePath.$dir."/";
					$found=@file_exists($file);
				}
				else
				{
					$tplDir=FLEX_APP_DIR_ROOT.$corePath.$dir."/";
				}
				$item["ext"]=false;
				$item["file"]=$file;
				$item["found"]=$found;
				$item["name"]=self::$clStyles[$cnt]["name"];
				$item["tplDir"]=$tplDir;
			}
			$styles[]=$item;
		}
		$dir=FLEX_APP_DIR_TPL."/".self::$config["template"]."/".self::$class;
		$file=FLEX_APP_DIR."/".$dir."/styles/ender.css";
		$found=@file_exists($file);
		if(FLEX_APP_DIR_SRC && !$found)
		{
			$file=FLEX_APP_DIR_SRC.".core/".$file;
			$tplDir=FLEX_APP_DIR_ROOT."?feh-rsc-get=auto&path=/".FLEX_APP_DIR."/".$dir."/";
			$found=@file_exists($file);
		}
		else
		{
			$tplDir=FLEX_APP_DIR_ROOT.FLEX_APP_DIR."/".$dir."/";
		}
		$styles[]=array("class"=>self::$class,"ext"=>false,"file"=>$file,"found"=>$found,"name"=>"ender","tplDir"=>$tplDir);//ext - external script
		//сохраняем список для css.php
		$md=md5(serialize($styles));
		$url=cache::check(self::$class,$md,self::$config["cacheEvalCss"],"css");
		if(!$url)
		{
			$cont=self::_buildStyleSheet($styles);
			if(!$cont)die("CSS render error.");
			$url=cache::set(self::$class,$md,self::$config["cacheEvalCss"],$cont,false,"css");
			if(!$url)die("CSS render error.");
		}
?>
	<link type="text/css" href="<?php 
echo FLEX_APP_DIR_ROOT . $url;
?>
" media="all" rel="stylesheet" />
<?
		for($cnt=0;$cnt<$len;$cnt++)
		{
			if(self::$clStyles[$cnt]["http"])
			{
?>
	<link type="text/css" href="<?php 
echo self::$clStyles[$cnt]["name"];
?>
" media="all" rel="stylesheet" />
<?
//.........这里部分代码省略.........
开发者ID:bogdan-nazar,项目名称:flex.engine.core,代码行数:101,代码来源:render.php

示例13: setCollect

 public function setCollect($collect)
 {
     if ($collect == 1) {
         cache::set('collect' . $this->getId(), $this->getId());
     } else {
         cache::deleteBySearch('collect' . $this->getId());
     }
 }
开发者ID:jimibi,项目名称:core,代码行数:8,代码来源:cmd.class.php

示例14: load

 function load()
 {
     // initiate the site and make pages and page
     // globally available
     $pages = $this->pages;
     $page = $this->pages->active();
     // check for ssl
     if (c::get('ssl')) {
         // if there's no https in the url
         if (!server::get('https')) {
             go(str_replace('http://', 'https://', $page->url()));
         }
     }
     // check for index.php in rewritten urls and rewrite them
     if (c::get('rewrite') && preg_match('!index.php\\/!i', $this->uri->original)) {
         go($page->url());
     }
     // check for a misconfigured subfolder install
     if ($page->isErrorPage()) {
         // if you want to store subfolders in the homefolder for blog articles i.e. and you
         // want urls like http://yourdomain.com/article-title you can set
         // RedirectMatch 301 ^/home/(.*)$ /$1 in your htaccess file and those
         // next lines will take care of delivering the right pages.
         $uri = c::get('home') . '/' . $this->uri->path();
         if ($redirected = $this->pages()->find($uri)) {
             if ($redirected->uri() == $uri) {
                 $page = $redirected;
                 $this->pages->active = $page;
                 $this->uri = new uri($uri);
             }
         }
         // try to rewrite broken translated urls
         // this will only work for default uris
         if (c::get('lang.support')) {
             $path = $this->uri->path->toArray();
             $obj = $pages;
             $found = false;
             foreach ($path as $p) {
                 // first try to find the page by uid
                 $next = $obj->{'_' . $p};
                 if (!$next) {
                     // go through each translation for each child page
                     // and try to find the url_key or uid there
                     foreach ($obj as $child) {
                         foreach (c::get('lang.available') as $lang) {
                             $c = $child->content($lang);
                             // redirect to the url if a translated url has been found
                             if ($c && $c->url_key() == $p && !$child->isErrorPage()) {
                                 $next = $child;
                             }
                         }
                     }
                     if (!$next) {
                         break;
                     }
                 }
                 $found = $next;
                 $obj = $next->children();
             }
             if ($found && !$found->isErrorPage()) {
                 go($found->url());
             }
         }
     }
     // redirect file urls (file:image.jpg)
     if ($this->uri->param('file')) {
         // get the local file
         $file = $page->files()->find($this->uri->param('file'));
         if ($file) {
             go($file->url());
         }
     }
     // redirect /home to /
     if ($this->uri->path() == c::get('home')) {
         go(url());
     }
     // redirect tinyurls
     if ($this->uri->path(1) == c::get('tinyurl.folder') && c::get('tinyurl.enabled')) {
         $hash = $this->uri->path(2);
         if (!empty($hash)) {
             $resolved = $this->pages->findByHash($hash)->first();
             // redirect to the original page
             if ($resolved) {
                 go(url($resolved->uri));
             }
         }
     }
     // set the global template vars
     tpl::set('site', $this);
     tpl::set('pages', $pages);
     tpl::set('page', $page);
     $cacheID = $this->htmlCacheID();
     $cacheModified = time();
     $cacheData = null;
     if ($this->htmlCacheEnabled) {
         // check if the cache is disabled for some reason
         $this->htmlCacheEnabled = $page->isErrorPage() || in_array($page->uri(), c::get('cache.ignore', array())) ? false : true;
         // check for the last modified date of the cache file
         $cacheModified = cache::modified($cacheID);
         // check if the files have been modified
//.........这里部分代码省略.........
开发者ID:codecuts,项目名称:lanningsmith-website,代码行数:101,代码来源:site.php

示例15: getWeatherFromYahooXml

 public function getWeatherFromYahooXml()
 {
     if ($this->getConfiguration('city') == '') {
         return false;
     }
     $cache = cache::byKey('yahooWeatherXml' . $this->getConfiguration('city'));
     if ($cache->getValue() === '' || $cache->getValue() == 'false') {
         $request = new com_http('http://weather.yahooapis.com/forecastrss?w=' . urlencode($this->getConfiguration('city')) . '&u=c');
         $xmlMeteo = $request->exec(5000, 0);
         cache::set('yahooWeatherXml' . $this->getConfiguration('city'), $xmlMeteo, 7200);
     } else {
         $xmlMeteo = $cache->getValue();
     }
     return self::parseXmlWeather($xmlMeteo);
 }
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:15,代码来源:weather.class.php


注:本文中的cache::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。