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


PHP CacheUtil::get方法代码示例

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


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

示例1: 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

示例2: 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

示例3: __construct

 public function __construct(ICFlowForm $form)
 {
     $cache = CacheUtil::get("form_" . $form->getID());
     if (is_array($cache)) {
         $this->_cache = $cache;
     }
     parent::__construct($form);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:8,代码来源:SimpleHtmlParser.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: fetchCaches

 protected function fetchCaches($pks)
 {
     $return = array();
     if ($this->getIsAllowCache()) {
         foreach ($pks as $pk) {
             $data = CacheUtil::get($this->getCacheKey($pk));
             if ($data !== false) {
                 $return[$pk] = $data;
             }
         }
     }
     return !empty($return) ? $return : false;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:13,代码来源:ICModel.php

示例13: 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

示例14: getCommentInfo

 public function getCommentInfo($id, $source = true)
 {
     $id = intval($id);
     if (empty($id)) {
         $this->addError("get", Ibos::lang("Parameters error", "error"));
         return false;
     }
     $info = CacheUtil::get("comment_info_" . $id);
     if ($info) {
         return $info;
     } else {
         $info = $this->fetchByPk($id);
         $info["user_info"] = User::model()->fetchByUid($info["uid"]);
         $info["content"] = $info["content"];
         $source && ($info["sourceInfo"] = Source::getCommentSource($info));
         $source && CacheUtil::set("comment_info_" . $id, $info);
         return $info;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:19,代码来源:Comment.php

示例15: 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


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