當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CacheManager::cache_set方法代碼示例

本文整理匯總了PHP中CacheManager::cache_set方法的典型用法代碼示例。如果您正苦於以下問題:PHP CacheManager::cache_set方法的具體用法?PHP CacheManager::cache_set怎麽用?PHP CacheManager::cache_set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CacheManager的用法示例。


在下文中一共展示了CacheManager::cache_set方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct($request, $response)
 {
     parent::__construct($request, $response);
     //$this->checkAllowIP();
     $role_id = $this->isAdmin();
     if ($role_id < 1) {
         return $this->redirect('admin/login/index');
     }
     if ($GLOBALS['user_id'] > 0) {
         $user = CacheManager::getUser();
         $uri = addslashes(@$_SERVER['REQUEST_URI']);
         if (Util::filterOnlineUrl($uri)) {
             $update_time = 0;
             $key = 'last_time_' . $GLOBALS['user_id'];
             $time = CacheManager::cache_get($key, 0);
             if ($time > 0) {
                 $update_time = TIMESTAMP - $time;
             }
             if ($update_time < 0) {
                 $update_time = 0;
             }
             Model::factory('App')->updateAdminOnline($GLOBALS['user_id'], $uri, Util::getIP(), $update_time, addslashes(json_encode(@$_REQUEST)));
             CacheManager::cache_set($key, TIMESTAMP);
         }
     }
 }
開發者ID:rucky2013,項目名稱:kohana-php-admin,代碼行數:26,代碼來源:AdminController.php

示例2: initApp

 public function initApp(&$obj)
 {
     $sessionKey = $obj->req('sessionKey');
     $obj->income = Util::up_decode($sessionKey);
     if ($obj->income && $obj->income['u'] > 0) {
         $obj->uid = $obj->income['u'];
         $obj->user = CacheManager::getUser($obj->uid);
         if (!isset($obj->income['l'])) {
             $obj->income['l'] = $obj->user->locale;
         }
         $obj->locale = $obj->getLocale($obj->income['l']);
         $obj->lang = $obj->getLang($obj->locale);
         $obj->mobile = $obj->income['m'] == 1 ? true : false;
         $obj->login($obj->uid);
     } else {
         if ($GLOBALS['user_id'] > 0) {
             $obj->uid = $GLOBALS['user_id'];
             $obj->user = CacheManager::getUser($obj->uid);
             if (!$obj->user) {
                 $GLOBALS['user_id'] = 0;
                 $obj->uid = 0;
                 $obj->locale = $obj->getLocale(Util::determineLang());
                 $obj->lang = $obj->getLang($obj->locale);
             } else {
                 $obj->locale = $obj->getLocale($obj->user->locale);
                 $obj->lang = $obj->getLang($obj->locale);
             }
         } else {
             $obj->locale = $obj->getLocale(Util::determineLang());
             $obj->lang = $obj->getLang($obj->locale);
         }
     }
     if ($obj->uid > 0) {
         $uri = addslashes(@$_SERVER['REQUEST_URI']);
         if (Util::filterOnlineUrl($uri)) {
             $update_time = 0;
             $key = 'last_time_' . $obj->uid;
             $time = CacheManager::cache_get($key, 0);
             if ($time > 0) {
                 $update_time = TIMESTAMP - $time;
             }
             if ($update_time < 0) {
                 $update_time = 0;
             }
             Model::factory('App')->updateUserOnline($obj->uid, $uri, Util::getIP(), $update_time);
             CacheManager::cache_set($key, TIMESTAMP);
         }
     }
 }
開發者ID:rucky2013,項目名稱:kohana-php-admin,代碼行數:49,代碼來源:AppController.php

示例3: getpassport

 public function getpassport($username, $password)
 {
     if (!Util::check_username($username)) {
         return -4;
     }
     $key = 'logins_' . $username;
     $logins = CacheManager::cache_get($key, 0);
     if ($logins > 10) {
         return -5;
     }
     CacheManager::cache_set($key, $logins + 1);
     return $this->check_login($username, $password);
 }
開發者ID:rucky2013,項目名稱:kohana-php-admin,代碼行數:13,代碼來源:BaseController.php


注:本文中的CacheManager::cache_set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。