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


PHP CacheUtil类代码示例

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


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

示例1: endTestSuite

 public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
 {
     $cache = new CacheUtil();
     //      if there were failed tests hand off to CacheUtil
     if (!empty($this->failedTests)) {
         $cache->createCache($this->failedTests, $_SERVER['argv']);
     } else {
         //          delete cache file if all tests passed
         $cache->deleteCache($_SERVER['argv']);
     }
 }
开发者ID:KarlCOG,项目名称:cog-phpunit-rerun,代码行数:11,代码来源:FailureListener.php

示例2: testCreateAndReadCache

 public function testCreateAndReadCache()
 {
     $cache = new CacheUtil();
     $test1 = new RerunRandomTest();
     $test2 = new RerunRandomTest();
     $failedTestsToWrite = array(array('testMethodName' => $test1->getName(), 'testClassName' => get_class($test1)), array('testMethodName' => $test2->getName(), 'testClassName' => get_class($test2)));
     $cmdOptions = array('phpunit', 'testName');
     $cache->createCache($failedTestsToWrite, $cmdOptions);
     $key = $cache->generateKey($cmdOptions);
     $failedTestsFromFile = $cache->readCache($key);
     $this->assertEquals($failedTestsToWrite, $failedTestsFromFile, 'Test written to file differ from those read from file');
 }
开发者ID:KarlCOG,项目名称:cog-phpunit-rerun,代码行数:12,代码来源:CacheUtilTest.php

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

示例4: actionParam

 public function actionParam()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $data = array("sealfrom" => $_POST["seal_from"]);
         $workRemindBefore = intval($_POST["work_remind_before"]);
         $unitBefore = $_POST["unit_before"];
         if (!empty($workRemindBefore)) {
             $workRemindBefore .= $unitBefore;
             $data["wfremindbefore"] = $workRemindBefore;
         }
         $workRemindAfter = $_POST["work_remind_after"];
         $unitAfter = $_POST["unit_after"];
         if (!empty($workRemindAfter)) {
             $workRemindAfter .= $unitAfter;
             $data["wfremindafter"] = $workRemindAfter;
         }
         foreach ($data as $key => $value) {
             Setting::model()->updateSettingValueByKey($key, $value);
         }
         CacheUtil::update("setting");
         $this->success(Ibos::lang("Operation succeed", "message"));
     } else {
         $keys = "wfremindbefore,wfremindafter,sealfrom";
         $values = Setting::model()->fetchSettingValueByKeys($keys);
         $param = array();
         foreach ($values as $key => $value) {
             if ($key == "wfremindbefore" || $key == "wfremindafter") {
                 $param[$key . "desc"] = substr($value, 0, -1);
                 $param[$key . "unit"] = substr($value, -1, 1);
             }
             $param[$key] = $value;
         }
         $this->render("param", array("param" => $param));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:35,代码来源:DashboardController.php

示例5: actionRule

 public function actionRule()
 {
     $formSubmit = EnvUtil::submitCheck("creditRuleSubmit");
     if ($formSubmit) {
         $cycles = $_POST["cycles"];
         $credits = $_POST["credits"];
         $rewardNums = $_POST["rewardnums"];
         $rulesParam = array();
         foreach ($cycles as $ruleId => $cycle) {
             $rulesParam[$ruleId]["cycletype"] = $cycle;
         }
         foreach ($credits as $ruleId => $credit) {
             foreach ($credit as $extcreditOffset => $creditValue) {
                 $rulesParam[$ruleId]["extcredits" . $extcreditOffset] = $creditValue;
             }
         }
         foreach ($rewardNums as $ruleId => $rewardNum) {
             $rulesParam[$ruleId]["rewardnum"] = $rewardNum;
         }
         foreach ($rulesParam as $ruleId => $updateValue) {
             CreditRule::model()->modify($ruleId, $updateValue);
         }
         CacheUtil::update(array("creditRule"));
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $rules = CreditRule::model()->fetchAll();
         $credits = Credit::model()->fetchAll();
         $data = array("rules" => $rules, "credits" => $credits);
         $this->render("rule", $data);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:CreditController.php

示例6: actionSetup

 public function actionSetup()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $_POST["wbpostfrequency"] = 5 < intval($_POST["wbpostfrequency"]) ? $_POST["wbpostfrequency"] : 5;
         $_POST["wbnums"] = 140 <= intval($_POST["wbnums"]) ? $_POST["wbnums"] : 140;
         $wbwatermark = isset($_POST["wbwatermark"]) ? 1 : 0;
         $wbwcenabled = isset($_POST["wbwcenabled"]) ? 1 : 0;
         $postType = array("image" => 0, "topic" => 0, "praise" => 0);
         if (isset($_POST["wbposttype"])) {
             foreach ($postType as $key => &$val) {
                 if (isset($_POST["wbposttype"][$key])) {
                     $val = 1;
                 }
             }
         }
         if (isset($_POST["wbmovements"])) {
         } else {
             $_POST["wbmovements"] = array();
         }
         $data = array("wbnums" => $_POST["wbnums"], "wbpostfrequency" => $_POST["wbpostfrequency"], "wbposttype" => $postType, "wbwatermark" => $wbwatermark, "wbwcenabled" => $wbwcenabled, "wbmovement" => $_POST["wbmovements"]);
         foreach ($data as $key => $value) {
             Setting::model()->updateSettingValueByKey($key, $value);
         }
         CacheUtil::update("setting");
         $this->success(Ibos::lang("Operation succeed", "message"));
     } else {
         $data = array("config" => WbCommonUtil::getSetting(), "movementModule" => WbCommonUtil::getMovementModules());
         $this->render("setup", $data);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:30,代码来源:DashboardController.php

示例7: actionIndex

 public function actionIndex()
 {
     $unit = Setting::model()->fetchSettingValueByKey("unit");
     $formSubmit = EnvUtil::submitCheck("unitSubmit");
     if ($formSubmit) {
         $postData = array();
         if (!empty($_FILES["logo"]["name"])) {
             !empty($unit["logourl"]) && FileUtil::deleteFile($unit["logourl"]);
             $postData["logourl"] = $this->imgUpload("logo");
         } elseif (!empty($_POST["logourl"])) {
             $postData["logourl"] = $_POST["logourl"];
         } else {
             $postData["logourl"] = "";
         }
         $keys = array("phone", "fullname", "shortname", "fax", "zipcode", "address", "adminemail", "systemurl");
         foreach ($keys as $key) {
             if (isset($_POST[$key])) {
                 $postData[$key] = StringUtil::filterCleanHtml($_POST[$key]);
             } else {
                 $postData[$key] = "";
             }
         }
         Setting::model()->updateSettingValueByKey("unit", $postData);
         CacheUtil::update(array("setting"));
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $license = Setting::model()->fetchSettingValueByKey("license");
         $data = array("unit" => unserialize($unit), "license" => $license);
         $this->render("index", $data);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:UnitController.php

示例8: actionEdit

 public function actionEdit()
 {
     if (EnvUtil::submitCheck("emailSubmit")) {
         $setting = array();
         foreach ($this->_fields as $field) {
             if (array_key_exists($field, $_POST)) {
                 $setting[$field] = intval($_POST[$field]);
             } else {
                 $setting[$field] = 0;
             }
         }
         $roles = array();
         if (isset($_POST["role"])) {
             foreach ($_POST["role"] as $role) {
                 if (!empty($role["positionid"]) && !empty($role["size"])) {
                     $positionId = StringUtil::getId($role["positionid"]);
                     $roles[implode(",", $positionId)] = intval($role["size"]);
                 }
             }
         }
         $setting["emailroleallocation"] = serialize($roles);
         foreach ($setting as $key => $value) {
             Setting::model()->updateSettingValueByKey($key, $value);
         }
         CacheUtil::update("setting");
         $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index"));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:DashboardController.php

示例9: actionEdit

 public function actionEdit()
 {
     if (Ibos::app()->request->getIsAjaxRequest()) {
         if (EnvUtil::getRequest("op") === "structure") {
             $curId = EnvUtil::getRequest("curid");
             $objId = EnvUtil::getRequest("objid");
             $status = $this->setStructure($curId, $objId);
             $this->ajaxReturn(array("IsSuccess" => $status), "json");
         }
         $deptId = EnvUtil::getRequest("deptid");
         if ($deptId == 0) {
             $keys = array("phone", "fullname", "shortname", "fax", "zipcode", "address", "adminemail");
             $postData = array();
             foreach ($_POST as $key => $value) {
                 if (in_array($key, $keys)) {
                     $postData[$key] = $value;
                 }
             }
             Setting::model()->updateSettingValueByKey("unit", $postData);
             $editStatus = true;
             CacheUtil::update(array("setting"));
         } else {
             $this->dealWithBranch();
             $this->dealWithSpecialParams();
             $data = Department::model()->create();
             $editStatus = Department::model()->modify($data["deptid"], $data);
             $editStatus && OrgUtil::update();
         }
         $this->ajaxReturn(array("IsSuccess" => !!$editStatus), "json");
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:DepartmentController.php

示例10: actionUpdate

 public function actionUpdate()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $fieldArr = array("reporttypemanage" => "", "stampenable" => 0, "stampdetails" => "", "pointsystem" => 5, "autoreview" => 0, "autoreviewstamp" => 1);
         foreach ($_POST as $key => $value) {
             if (in_array($key, array_keys($fieldArr))) {
                 $fieldArr[$key] = $value;
             }
         }
         $stampStr = "";
         if (!empty($fieldArr["stampdetails"])) {
             foreach ($fieldArr["stampdetails"] as $score => $stampId) {
                 $stampId = empty($stampId) ? 0 : $stampId;
                 $stampStr .= $stampId . ":" . $score . ",";
             }
         }
         $fieldArr["stampdetails"] = rtrim($stampStr, ",");
         $apprise = EnvUtil::getRequest("apprise");
         if (empty($_POST["stampdetails"][$apprise])) {
             $fieldArr["autoreview"] = 0;
         } else {
             $fieldArr["autoreviewstamp"] = $_POST["stampdetails"][$apprise];
         }
         Setting::model()->modify("reportconfig", array("svalue" => serialize($fieldArr)));
         CacheUtil::update("setting");
         $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("dashboard/index"));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:DashboardController.php

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

示例12: actionAdd

 public function actionAdd()
 {
     $flowId = intval(EnvUtil::getRequest("flowid"));
     $flow = new ICFlowType($flowId);
     if (EnvUtil::submitCheck("formhash")) {
         $this->checkFlowAccess($flowId, 1, $this->createUrl("new/add"));
         $this->beforeAdd($_POST, $flow);
         $run = array("name" => $_POST["name"], "flowid" => $flowId, "beginuser" => $this->uid, "begintime" => TIMESTAMP);
         $runId = FlowRun::model()->add($run, true);
         $runProcess = array("runid" => $runId, "processid" => 1, "uid" => $this->uid, "flag" => FlowConst::PRCS_UN_RECEIVE, "flowprocess" => 1, "createtime" => TIMESTAMP);
         FlowRunProcess::model()->add($runProcess);
         if (strstr($flow->autoname, "{N}")) {
             FlowType::model()->updateCounters(array("autonum" => 1), sprintf("flowid = %d", $flowId));
             CacheUtil::rm("flowtype_" . $flowId);
         }
         $runData = array("runid" => $runId, "name" => $_POST["name"], "beginuser" => $this->uid, "begin" => TIMESTAMP);
         $this->handleRunData($flow, $runData);
         $param = array("flowid" => $flowId, "runid" => $runId, "processid" => 1, "flowprocess" => 1, "fromnew" => 1);
         $jumpUrl = $this->createUrl("form/index", array("key" => WfCommonUtil::param($param)));
         $this->ajaxReturn(array("isSuccess" => true, "jumpUrl" => $jumpUrl));
     } else {
         $this->checkFlowAccess($flowId, 1);
         if (!empty($flow->autoname)) {
             $runName = WfNewUtil::replaceAutoName($flow, $this->uid);
         } else {
             $runName = sprintf("%s (%s)", $flow->name, date("Y-m-d H:i:s"));
         }
         $data = array("flow" => $flow->toArray(), "runName" => $runName, "lang" => Ibos::getLangSources());
         $this->renderPartial("add", $data);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:NewController.php

示例13: actionSetup

 public function actionSetup()
 {
     $formSubmit = EnvUtil::submitCheck("formhash");
     if ($formSubmit) {
         $data =& $_POST;
         foreach (array("sendemail", "sendsms", "sendmessage") as $field) {
             if (!empty($data[$field])) {
                 $ids = array_keys($data[$field]);
                 $idstr = implode(",", $ids);
                 Notify::model()->updateAll(array($field => 1), sprintf("FIND_IN_SET(id,'%s')", $idstr));
                 Notify::model()->updateAll(array($field => 0), sprintf("NOT FIND_IN_SET(id,'%s')", $idstr));
             } else {
                 Notify::model()->updateAll(array($field => 0));
             }
         }
         CacheUtil::update("NotifyNode");
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $nodeList = Notify::model()->getNodeList();
         foreach ($nodeList as &$node) {
             $node["moduleName"] = Module::model()->fetchNameByModule($node["module"]);
         }
         $this->render("setup", array("nodeList" => $nodeList));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:25,代码来源:NotifyController.php

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

示例15: actionIndex

 public function actionIndex()
 {
     $types = EnvUtil::getRequest("updatetype");
     $data = array();
     if (EnvUtil::submitCheck("formhash")) {
         $type = implode(",", $types);
         if (!empty($type)) {
             $this->redirect($this->createUrl("update/index", array("doupdate" => 1, "updatetype" => $type)));
         }
     }
     if (Ibos::app()->request->getIsAjaxRequest()) {
         $op = EnvUtil::getRequest("op");
         if (LOCAL) {
             @set_time_limit(0);
         }
         if ($op == "data") {
             CacheUtil::update();
         }
         if ($op == "static") {
             LOCAL && Ibos::app()->assetManager->republicAll();
             OrgUtil::update();
         }
         if ($op == "module") {
             ModuleUtil::updateConfig();
         }
         Ibos::app()->cache->clear();
         $this->ajaxReturn(array("isSuccess" => true));
     }
     if (EnvUtil::getRequest("doupdate") == 1) {
         $type = explode(",", trim($types, ","));
         $data["doUpdate"] = true;
         foreach ($type as $index => $act) {
             if (!empty($act)) {
                 if (in_array("data", $type)) {
                     unset($type[$index]);
                     $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Data cache");
                     $data["op"] = "data";
                     break;
                 }
                 if (in_array("static", $type)) {
                     unset($type[$index]);
                     $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Static cache");
                     $data["op"] = "static";
                     break;
                 }
                 if (in_array("module", $type)) {
                     $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Module setting");
                     $data["op"] = "module";
                     unset($type[$index]);
                     break;
                 }
             }
         }
         $data["next"] = $this->createUrl("update/index", array("doupdate" => intval(!empty($type)), "updatetype" => implode(",", $type)));
     } else {
         $data["doUpdate"] = false;
     }
     $this->render("index", $data);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:59,代码来源:UpdateController.php


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