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


PHP CacheUtil::set方法代码示例

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


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

示例1: fetchAllCache

 public function fetchAllCache($cacheNames)
 {
     $cacheNames = is_array($cacheNames) ? $cacheNames : array($cacheNames);
     $data = CacheUtil::get($cacheNames);
     if (is_array($data) && in_array(false, $data, true) || !$data) {
         $data = false;
     }
     $newArray = $data !== false ? array_diff($cacheNames, array_keys($data)) : $cacheNames;
     if (empty($newArray)) {
         foreach ($data as &$cache) {
             $isSerialized = $cache == serialize(false) || @unserialize($cache) !== false;
             $cache = $isSerialized ? unserialize($cache) : $cache;
         }
         return $data;
     } else {
         $cacheNames = $newArray;
     }
     $caches = $this->fetchAll(sprintf("FIND_IN_SET(name,'%s')", implode(",", $cacheNames)));
     if ($caches) {
         foreach ($caches as $sysCache) {
             $data[$sysCache["name"]] = $sysCache["type"] ? unserialize($sysCache["value"]) : $sysCache["value"];
             CacheUtil::set($sysCache["name"], $data[$sysCache["name"]]);
         }
         foreach ($cacheNames as $name) {
             if ($data[$name] === null) {
                 $data[$name] = null;
                 CacheUtil::rm($name);
             }
         }
     }
     return $data;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:32,代码来源:Syscache.php

示例2: parse

 public function parse($isUpdate = false)
 {
     Ibos::import("application.extensions.simple_html_dom", true);
     if ($isUpdate) {
         $model = preg_replace("/\\s+data-id\\s?=\\s?\"?\\d+\"?/i", "", $this->printmodel);
         $max = 0;
     } else {
         $model = $this->printmodel;
         $max = intval($this->itemmax);
     }
     $elements = array();
     $doc = new simple_html_dom();
     $doc->load($model, true, true, CHARSET);
     $items = $doc->find("ic");
     $config = $this->getItemConfig();
     if (!empty($items) && !empty($config)) {
         $this->refactor($items, $config, $max, $elements);
     }
     $html = $doc->save();
     $this->_cache = $elements;
     CacheUtil::set("form_" . $this->ID, $elements);
     $form["printmodelshort"] = $html;
     if ($max != $this->itemmax) {
         $form["itemmax"] = $max;
     }
     $doc->clear();
     FlowFormType::model()->modify($this->ID, $form);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:SimpleHtmlParser.php

示例3: getSourceInfo

 public static function getSourceInfo($table, $rowId, $forApi = false, $moduleName = "weibo")
 {
     static $_forApi = "0";
     $_forApi == "0" && ($_forApi = intval($forApi));
     $key = $_forApi ? $table . $rowId . "_api" : $table . $rowId;
     $info = CacheUtil::get("source_info_" . $key);
     if ($info) {
         return $info;
     }
     switch ($table) {
         case "feed":
             $info = self::getInfoFromFeed($table, $rowId, $_forApi);
             break;
         case "comment":
             $info = self::getInfoFromComment($table, $rowId, $_forApi);
             break;
         default:
             $table = ucfirst($table);
             $model = $table::model();
             if (method_exists($model, "getSourceInfo")) {
                 $info = $model->getSourceInfo($rowId, $_forApi);
             }
             unset($model);
             break;
     }
     $info["source_table"] = $table;
     $info["source_id"] = $rowId;
     CacheUtil::set("source_info_" . $key, $info);
     return $info;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:30,代码来源:Source.php

示例4: getNodeList

 public function getNodeList()
 {
     $list = CacheUtil::get("notifyNode");
     if (!$list) {
         $list = $this->fetchAllSortByPk("node", array("order" => "`module` DESC"));
         CacheUtil::set("notifyNode", $list);
     }
     return $list;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:9,代码来源:Notify.php

示例5: getPurv

 public static function getPurv($posId)
 {
     $access = CacheUtil::get("purv_" . $posId);
     if (!$access) {
         $access = Ibos::app()->getAuthManager()->getItemChildren($posId);
         CacheUtil::set("purv_" . $posId, array_flip(array_map("strtolower", array_keys($access))));
     }
     return $access;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:9,代码来源:PositionUtil.php

示例6: getLogTableId

 public static function getLogTableId()
 {
     $tableId = CacheUtil::get("logtableid");
     if ($tableId === false) {
         $tableId = Ibos::app()->db->createCommand()->select("svalue")->from("{{setting}}")->where("skey = 'logtableid'")->queryScalar();
         CacheUtil::set("logtableid", intval($tableId));
     }
     return $tableId;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:9,代码来源:Log.php

示例7: fetchAllEnabledModule

 public function fetchAllEnabledModule()
 {
     $module = CacheUtil::get("module");
     if ($module == false) {
         $criteria = array("condition" => "`disabled` = 0", "order" => "`sort` ASC");
         $module = $this->fetchAllSortByPk("module", $criteria);
         CacheUtil::set("module", $module);
     }
     return $module;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:10,代码来源:Module.php

示例8: processCmdCache

 private function processCmdCache($cmd, $name, $ttl = 0)
 {
     $ret = "";
     switch ($cmd) {
         case "set":
             $ret = CacheUtil::set("process_lock_" . $name, TIMESTAMP, $ttl);
             break;
         case "get":
             $ret = CacheUtil::get("process_lock_" . $name);
             break;
         case "rm":
             $ret = CacheUtil::rm("process_lock_" . $name);
     }
     return $ret;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:15,代码来源:ICProcess.php

示例9: getUserData

 public function getUserData($uid = "")
 {
     if (empty($uid)) {
         $uid = Ibos::app()->user->uid;
     }
     if (($data = CacheUtil::get("userData_" . $uid)) === false || count($data) == 1) {
         $data = array();
         $list = $this->fetchAll("`uid` = :uid", array(":uid" => $uid));
         if (!empty($list)) {
             foreach ($list as $v) {
                 $data[$v["key"]] = (int) $v["value"];
             }
         }
         CacheUtil::set("userData_" . $uid, $data, 60);
     }
     return $data;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:17,代码来源:UserData.php

示例10: fetchAllEnabledModule

 public function fetchAllEnabledModule()
 {
     $module = CacheUtil::get("module");
     if ($module == false) {
         $criteria = array("condition" => "`disabled` = 0", "order" => "`sort` ASC");
         $module = $this->fetchAllSortByPk("module", $criteria);
         if (defined("LICENCE_DISABLE")) {
             $disabledModules = explode(",", LICENCE_DISABLE);
         } else {
             $disabledModules = false;
         }
         if ($disabledModules) {
             foreach ($module as $index => $mod) {
                 if (in_array($mod["module"], $disabledModules)) {
                     unset($module[$index]);
                 }
             }
         }
         CacheUtil::set("module", $module);
     }
     return $module;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:22,代码来源:Module.php

示例11: getAllExpression

 public static function getAllExpression($flush = false)
 {
     $cacheId = "expression";
     if (($res = CacheUtil::get($cacheId)) === false || $flush === true) {
         $filepath = "static/image/expression/";
         $expression = new Dir($filepath);
         $expression_pkg = $expression->toArray();
         $res = array();
         $typeMap = array("df" => "默认", "bm" => "暴漫");
         foreach ($expression_pkg as $index => $value) {
             list($file) = explode(".", $value["filename"]);
             list($type) = explode("_", $file);
             $temp["value"] = $file;
             $temp["phrase"] = "[" . $file . "]";
             $temp["icon"] = $value["filename"];
             $temp["type"] = $type;
             $temp["category"] = $typeMap[$type];
             $res[$temp["phrase"]] = $temp;
         }
         CacheUtil::set($cacheId, $res);
     }
     return $res;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:23,代码来源:ExpressionUtil.php

示例12: loadProcessCache

 public static function loadProcessCache($flowId)
 {
     $cacheName = "flowprocess_" . intval($flowId);
     $cache = CacheUtil::get($cacheName);
     if ($cache === false) {
         $cache = array();
         $data = Ibos::app()->db->createCommand()->select("ft.name,ft.type,fp.*")->from("{{flow_type}} ft")->leftJoin("{{flow_process}} fp", "ft.flowid = fp.flowid")->where(sprintf("ft.flowid = %d", $flowId))->order("ft.flowid,fp.processid")->queryAll();
         foreach ($data as $process) {
             $cache[$process["processid"]] = $process;
         }
         CacheUtil::set($cacheName, $cache);
     }
     return $cache;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:14,代码来源:WfCommonUtil.php

示例13: handleNode

 public function handleNode($event)
 {
     CacheUtil::set("notifyNode", NULL);
     Notify::model()->getNodeList();
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:5,代码来源:NotifyNodeCacheProvider.php

示例14: parseAtByUserName

 private static function parseAtByUserName($name)
 {
     $info = CacheUtil::get("userInfoRealName_" . md5($name[1]));
     if (!$info) {
         $info = User::model()->fetchByRealname($name[1]);
         CacheUtil::set("userInfoRealName_" . md5($name[1]), $info);
     }
     if ($info) {
         return "<a class=\"anchor\" data-toggle=\"usercard\" data-param=\"uid=" . $info["uid"] . "\" href=\"" . $info["space_url"] . "\" target=\"_blank\">" . $name[0] . "</a>";
     } else {
         return $name[0];
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:13,代码来源:StringUtil.php

示例15: implode

<?php

CacheUtil::set("notifyNode", null);
$diaryComments = Comment::model()->fetchAllByAttributes(array("module" => "diary"));
$cidArr = ConvertUtil::getSubByKey($diaryComments, "cid");
if (!empty($diaryComments)) {
    $cidStr = implode(",", $cidArr);
    Comment::model()->deleteAll("rowid IN({$cidStr})");
    Comment::model()->deleteAllByAttributes(array("module" => "diary"));
}
开发者ID:AxelPanda,项目名称:ibos,代码行数:10,代码来源:extention.php


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