本文整理汇总了PHP中CacheUtil::load方法的典型用法代码示例。如果您正苦于以下问题:PHP CacheUtil::load方法的具体用法?PHP CacheUtil::load怎么用?PHP CacheUtil::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheUtil
的用法示例。
在下文中一共展示了CacheUtil::load方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ipBanned
public static function ipBanned($onlineip)
{
CacheUtil::load("ipbanned");
$ipBanned = Ibos::app()->setting->get("cache/ipbanned");
if (empty($ipBanned)) {
return false;
} else {
if ($ipBanned["expiration"] < TIMESTAMP) {
CacheUtil::update("ipbanned");
CacheUtil::load("ipbanned", true);
$ipBanned = Ibos::app()->setting->get("cache/ipbanned");
}
return preg_match("/^(" . $ipBanned["regexp"] . ")\$/", $onlineip);
}
return preg_match("/^(" . $ipBanned["regexp"] . ")\$/", $onlineip);
}
示例2: createStaticJs
private static function createStaticJs()
{
CacheUtil::load(array("department", "position"), true);
$unit = Ibos::app()->setting->get("setting/unit");
$department = DepartmentUtil::loadDepartment();
$users = UserUtil::loadUser();
$position = PositionUtil::loadPosition();
$positionCategory = PositionUtil::loadPositionCategory();
$companyData = self::initCompany($unit);
$deptData = self::initDept($department);
$userData = self::initUser($users);
$posData = self::initPosition($position);
$posCatData = self::initPositionCategory($positionCategory);
$default = file_get_contents(PATH_ROOT . "/static/js/src/org.default.js");
if ($default) {
$patterns = array("/\\{\\{(company)\\}\\}/", "/\\{\\{(department)\\}\\}/", "/\\{\\{(position)\\}\\}/", "/\\{\\{(users)\\}\\}/", "/\\{\\{(positioncategory)\\}\\}/");
$replacements = array($companyData, $deptData, $posData, $userData, $posCatData);
$new = preg_replace($patterns, $replacements, $default);
FileUtil::createFile("data/org.js", $new);
CacheUtil::update("setting");
}
}
示例3: array
$replace = array(time(), strtotime('-1 hour'), strtotime('+1 hour'), strtotime(date('Y-m-d')), strtotime('-1 day', strtotime(date('Y-m-d'))));
$sql = str_replace($search, $replace, $sqlData);
executeSql($sql);
unset($_SESSION['extData']);
}
// 安装工作流数据
if (getIsInstall('workflow')) {
$sqlFlowData = file_get_contents(PATH_ROOT . './install/data/installFlow.sql');
executeSql($sqlFlowData);
}
session_destroy();
$cacheArr = array('AuthItem', 'CreditRule', 'Department', 'Ipbanned', 'Nav', 'NotifyNode', 'Position', 'PositionCategory', 'Setting', 'UserGroup');
foreach ($cacheArr as $cache) {
CacheUtil::update($cache);
}
CacheUtil::load('usergroup');
// 要注意小写
CacheUtil::update('Users');
// 因为用户缓存要依赖usergroup缓存,所以放在最后单独更新
file_put_contents(PATH_ROOT . 'data/install.lock', '');
$configfile = CONFIG_PATH . 'config.php';
$config = (require $configfile);
include 'extInfo.php';
exit;
} elseif ($option == 'tablepreCheck') {
$dbHost = $_POST['dbHost'];
$dbAccount = $_POST['dbAccount'];
$dbPassword = $_POST['dbPassword'];
$dbName = $_POST['dbName'];
$tablePre = $_POST['tablePre'];
if (!function_exists('mysql_connect')) {
示例4: afterDelete
public function afterDelete()
{
CacheUtil::update("department");
CacheUtil::load("department");
parent::afterDelete();
}
示例5: afterSave
public function afterSave()
{
$pk = $this->getPrimaryKey();
if ($pk) {
$category = Yii::app()->setting->get("officialdoccategory");
$attr = $this->getAttributes();
$category[$pk] = $attr;
Syscache::model()->modify("officialdoccategory", $category);
CacheUtil::load("officialdoccategory", true);
}
parent::afterSave();
}
示例6: makeCache
public function makeCache($users)
{
Syscache::model()->modify("users", $users);
CacheUtil::load("users");
}
示例7: wrapUserInfo
public static function wrapUserInfo($user)
{
$user["group_title"] = "";
$user["next_group_credit"] = $user["upgrade_percent"] = 0;
$currentGroup = !empty($user["groupid"]) ? UserGroup::model()->fetchByPk($user["groupid"]) : array();
if (!empty($currentGroup)) {
$user["group_title"] = $currentGroup["title"];
if ($currentGroup["creditslower"] !== "0") {
$user["upgrade_percent"] = round((double) $user["credits"] / $currentGroup["creditslower"] * 100, 2);
}
$user["next_group_credit"] = (int) $currentGroup["creditslower"];
}
$user["level"] = self::getUserLevel($user["groupid"]);
CacheUtil::load(array("department", "position"));
$position = PositionUtil::loadPosition();
$department = DepartmentUtil::loadDepartment();
if (0 < $user["deptid"]) {
$relatedDeptId = DepartmentRelated::model()->fetchAllDeptIdByUid($user["uid"]);
$deptIds = array_merge((array) $relatedDeptId, array($user["deptid"]));
$user["alldeptid"] = implode(",", array_unique($deptIds));
$user["allupdeptid"] = Department::model()->queryDept($user["alldeptid"]);
$user["alldowndeptid"] = Department::model()->fetchChildIdByDeptids($user["alldeptid"]);
$user["relatedDeptId"] = implode(",", $relatedDeptId);
$user["deptname"] = isset($department[$user["deptid"]]) ? $department[$user["deptid"]]["deptname"] : "";
} else {
$user["alldeptid"] = $user["allupdeptid"] = $user["alldowndeptid"] = $user["relatedDeptId"] = $user["deptname"] = "";
}
if (0 < $user["positionid"]) {
$relatedPosId = PositionRelated::model()->fetchAllPositionIdByUid($user["uid"]);
$posIds = array_merge(array($user["positionid"]), (array) $relatedPosId);
$user["allposid"] = implode(",", array_unique($posIds));
$user["relatedPosId"] = implode(",", $relatedPosId);
$user["posname"] = isset($position[$user["positionid"]]) ? $position[$user["positionid"]]["posname"] : "";
} else {
$user["allposid"] = $user["relatedPosId"] = $user["posname"] = "";
}
$user["space_url"] = "?r=user/home/index&uid=" . $user["uid"];
$user["avatar_middle"] = "avatar.php?uid={$user["uid"]}&size=middle&engine=" . ENGINE;
$user["avatar_small"] = "avatar.php?uid={$user["uid"]}&size=small&engine=" . ENGINE;
$user["avatar_big"] = "avatar.php?uid={$user["uid"]}&size=big&engine=" . ENGINE;
$user["bg_big"] = "bg.php?uid={$user["uid"]}&size=big&engine=" . ENGINE;
$user["bg_small"] = "bg.php?uid={$user["uid"]}&size=small&engine=" . ENGINE;
$profile = UserProfile::model()->fetchByUid($user["uid"]);
$user = array_merge($user, (array) $profile);
return $user;
}
示例8: getRule
public function getRule($action)
{
if (empty($action)) {
return false;
}
CacheUtil::load("creditrule");
$caches = Ibos::app()->setting->get("cache/creditrule");
$extcredits = $this->getExtCredits();
$rule = false;
if (is_array($caches[$action])) {
$rule = $caches[$action];
for ($i = 1; $i <= 5; $i++) {
if (empty($extcredits[$i])) {
unset($rule["extcredits" . $i]);
continue;
}
$rule["extcredits" . $i] = intval($rule["extcredits" . $i]);
}
}
return $rule;
}
示例9: getCreditLog
protected function getCreditLog()
{
CacheUtil::load(array("creditrule"));
$creditRule = CreditRule::model()->fetchAllSortByPk("rid");
$credits = Ibos::app()->setting->get("setting/extcredits");
$relateRules = CreditRuleLog::model()->fetchAllByAttributes(array("uid" => $this->getUid()));
$criteria = array("condition" => "`uid` = :uid", "params" => array(":uid" => $this->getUid()), "order" => "dateline DESC");
$count = CreditLog::model()->count($criteria);
$pages = PageUtil::create($count, 20);
$criteria["limit"] = 20;
$criteria["offset"] = $pages->getOffset();
$creditLog = CreditLog::model()->fetchAll($criteria);
return array("creditLog" => $creditLog, "relateRules" => $relateRules, "credits" => $credits, "creditRule" => $creditRule, "pages" => $pages);
}