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


PHP Doo::cache方法代码示例

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


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

示例1: beforeRun

 public function beforeRun($resource, $action)
 {
     $this->dir = ADMIN_ROOT . '/moban/';
     $this->img = '/' . ADMIN_ROOT . '/static/';
     $session = Doo::session('Lua');
     $auth = $session->get('auth');
     if (empty($auth)) {
         $sets = Doo::cache('php')->get('loginset');
         if ($sets && $sets['cardit'] == 1) {
             $xxxx = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
             $nums = range(1, 9);
             shuffle($xxxx);
             shuffle($nums);
             $aaaa = $xxxx[0] . $nums[0];
             $bbbb = $xxxx[1] . $nums[1];
             $session->cardcode = $aaaa . '@' . $bbbb;
         }
         include Lua::display('login', $this->dir);
         exit;
     }
     $auth = empty($auth) ? array(0, '') : Lua::clean(explode("\t", Lua::authcode($auth, 'DECODE')), 1);
     $user = Lua::get_one("select * from lua_admin where uid='" . intval($auth[0]) . "' and password='" . $auth[1] . "' and gid='1'");
     if (empty($user) || $user && $this->clientIP() != $user['loginip']) {
         $session->auth = '';
         Lua::admin_msg('操作提示', '请先登录', '/' . ADMIN_ROOT);
     }
     $rs = $this->acl()->process($user['perm'], $resource, $action);
     if ($rs) {
         return $rs;
     }
     $this->user = $user;
     $this->page = Lua::get_post('p') ? intval(Lua::get_post('p')) : 1;
     // 图片识别码, 借鉴自 supesite
     define('FILE_HASH', substr(md5($user['uid'] . '/' . time() . Lua::random(6)), 8, 16));
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:35,代码来源:__auth.php

示例2: prepareSidebar

 /**
  * Prepare sidebar data, random tags and archive list
  */
 private function prepareSidebar()
 {
     //if tags cache exist, skip retrieving from DB, expires every 5 minutes
     $cacheTagOK = Doo::cache('front')->testPart('sidebarTag', 300);
     if (!$cacheTagOK) {
         echo '<h2>Cache expired. Get Tags from DB!</h2>';
         //get random 10 tags
         Doo::loadModel('Tag');
         $tags = new Tag();
         $this->data['randomTags'] = $tags->limit(10, null, null, array('custom' => 'ORDER BY RAND()'));
     } else {
         $this->data['randomTags'] = array();
     }
     //if archive cache exist, skip retrieving from DB, archive expires when Post added, updated, deleted
     $cacheArchiveOK = Doo::cache('front')->testPart('sidebarArchive', 31536000);
     if (!$cacheArchiveOK) {
         echo '<h2>Cache expired. Get Archives from DB!</h2>';
         //you can pass data to constructor to set the Model properties
         Doo::loadModel('Post');
         $p = new Post(array('status' => 1));
         $this->data['archives'] = $p->getArchiveSummary();
     } else {
         $this->data['archives'] = array();
     }
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:28,代码来源:ErrorController.php

示例3: index

 public function index()
 {
     if ($this->user['perm'] != SUPER_MAN && SYSNAME != $this->user['channel']) {
         header("Location:/" . $this->user['channel'] . '/admin/');
         exit;
     }
     $list = Lua::get_more("select * from lua_channel where status='1'");
     $cssname = 'nav_list';
     if (SYSNAME != ADMIN_ROOT) {
         $session = Doo::session('Lua');
         $change_id = $session->get('change_id');
         $set = Lua::get('set');
         if ($set) {
             $session->change_id = empty($change_id) || $change_id == 0 ? 1 : 0;
             header("Location:/" . SYSNAME . "/" . ADMIN_ROOT . "/");
             exit;
         }
         $set_id = $change_id || $change_id == 1 ? 1 : 0;
         if ($set_id == 0) {
             Doo::cache('php')->hashing = false;
             $tree = Doo::cache('php')->get('category');
             $cssname = 'tree_list';
             $html = '';
             if ($tree) {
                 $html = $this->_tree($tree, 0);
             }
         }
     }
     include Lua::display('frame', $this->dir);
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:30,代码来源:__home.php

示例4: loginset

 private function loginset()
 {
     $data = Doo::cache('php')->get('loginset');
     $post = Lua::post('post');
     if ($post) {
         Doo::cache('php')->set('loginset', $post);
         Lua::ajaxmessage('success', '操作成功', './admin.htm?action=loginset');
     }
     include Lua::display('admin_loginset', $this->dir);
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:10,代码来源:__admin.php

示例5: index

 public function index()
 {
     $thisip = $this->clientIP();
     Lua::adminfail($thisip, 1);
     $username = Lua::post('username');
     $password = Lua::post('password');
     if (empty($username)) {
         Lua::admin_msg('信息提示', '请输入用户名');
     }
     if (empty($password)) {
         Lua::admin_msg('信息提示', '请输入密码');
     }
     $user = Lua::get_one("select * from lua_admin where username='{$username}' and password='" . md5($password) . "' and gid='1'");
     if (empty($user)) {
         Lua::adminfail($thisip);
         Lua::admin_msg('信息提示', '用户名或密码错误');
     }
     $auth = Lua::authcode($user['uid'] . "\t" . $user['password'], 'ENCODE');
     $session = Doo::session('Lua');
     // 口令卡验证
     $sets = Doo::cache('php')->get('loginset');
     if ($sets && $sets['cardit'] == 1) {
         $cardcode = $session->get('cardcode');
         $cardit = intval(Lua::post('cardit'));
         if (empty($cardit)) {
             Lua::admin_msg('信息提示', '请输入口令卡');
         }
         $cardex = explode('@', $cardcode);
         $b1 = $cardex[0][1];
         $b2 = $cardex[1][1];
         $secureid = $user['secureid'];
         $sdb = Lua::get_one("select * from lua_secure where id='{$secureid}' and uid='" . $user['uid'] . "'");
         if (empty($sdb)) {
             Lua::admin_msg('信息提示', '请先绑定口令卡后再登录');
         }
         $securekey = unserialize($sdb['securekey']);
         $x = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
         $k1 = array_search($cardex[0][0], $x);
         $k2 = array_search($cardex[1][0], $x);
         $truekey = $securekey[$b1][$k1] . $securekey[$b2][$k2];
         $truekey = intval($truekey);
         if ($truekey != $cardit) {
             Lua::adminfail($thisip);
             Lua::admin_msg('信息提示', '输入的口令卡错误', '/' . ADMIN_ROOT . '/');
         }
     }
     // end
     $session->auth = $auth;
     Doo::db()->query("update lua_admin set logintime='" . time() . "',logs=logs+1,loginip='" . $this->clientIP() . "' where uid='" . $user['uid'] . "'");
     Lua::delete('lua_admin_fails', array('ip' => $thisip));
     Lua::write_log($user, '登录后台', '---', $user['channel']);
     Lua::admin_msg('操作提示', '登录成功', '/' . ADMIN_ROOT);
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:53,代码来源:__login.php

示例6: __construct

 function __construct()
 {
     $this->table_ott_ba = 'ott_business_account';
     $this->table = 'ioss_cs_subscriber';
     $this->table_order = 'ioss_cs_order';
     $this->table_ppv = 'ioss_cs_ppv';
     $this->table_ppv_ext = 'ioss_cs_ppv_extend';
     $this->join_table = '';
     Doo::loadCore('cache/DooMemCache');
     $this->cache = Doo::cache('memcache');
     $this->cache->set_cache_name('User_MGM_3_' . CACHE_VERSION);
     $this->cache_time = 1800;
     $this->clearcache2 = $_GET['clear'] == 'cache' ? true : false;
     //$this->clearcache = true; //disable cache
     $this->svod_start_date = '2012-08-31 23:00:00';
     $this->start_date = $this->svod_start_date;
     $this->ppv_start_date = '2012-10-24 23:00:00';
 }
开发者ID:berlianaputri,项目名称:rps,代码行数:18,代码来源:User.php

示例7: __construct

 function __construct()
 {
     //parent::__construct();
     /*$this->_userid = $this->config->item('wsdlsdpuser');
       $this->_password = $this->config->item('wsdlsdppassword');
       $this->_sessionid = "app:6107134037402338164"; //app:3369532597166007412";*/
     //$this->ip_prod ='10.0.43.2';
     $this->ip_prod = 'ocsgat.telkom.co.id';
     $this->ip_dev = '10.0.40.101';
     //$this->ip_track = '10.0.43.3';
     $this->ip_track = 'servicebus.telkom.co.id';
     $this->ip_addr = $this->ip_prod;
     $this->ip_dev2 = "10.0.40.103:7001";
     //$this->ip_prod2 = "10.0.43.5:9001";
     $this->ip_prod2 = "servicebus.telkom.co.id:9001";
     //$this->ip_prod2 = "10.0.43.6:8002";
     $this->ip_addr2 = $this->ip_prod2;
     Doo::loadCore('cache/DooMemCache');
     $this->cache = Doo::cache('memcache');
     $this->cache->set_cache_name('SDPAPI_MGM_3_' . CACHE_VERSION);
     $this->cache_time = 1800;
     $this->clearcache = $_GET['clear'] == 'cache' ? true : false;
 }
开发者ID:berlianaputri,项目名称:rps,代码行数:23,代码来源:SDPAPI.php

示例8: __construct

 function __construct()
 {
     //parent::__construct(Doo::conf()->ga_profile['username'],Doo::conf()->ga_profile['password']);
     //$this->gapi = new gapi();
     Doo::loadCore('cache/DooMemCache');
     $this->cache = Doo::cache('memcache');
     $this->cache->set_cache_name('GA_MGM_1_' . CACHE_VERSION);
     $this->cache_time = 86400;
     $this->prevmonth = "2012-08-31";
     $this->clearcache = $_GET['clear'] == 'cache' ? true : false;
     $this->ppv_cat_code = 'C_TokoVideo_PPV';
     $this->svod_cat_code = 'C_TokoVideo_International';
     $keyfile = "http://assets.useetv.com/3511e533af3f.p12";
     $client_id = "928596884418-rbc228giii4ugmi8u1dguemk7hk5jvsi.apps.googleusercontent.com";
     $client_secret = "pSn-Fh-bbvCb326GbP4fTRfQ";
     $service_account_name = "928596884418-rbc228giii4ugmi8u1dguemk7hk5jvsi@developer.gserviceaccount.com";
     $client = new Google_Client();
     $client->setApplicationName("latif.asia:useetv");
     $client->setClientSecret($client_secret);
     $client->setDeveloperKey("AIzaSyDTta0lhZcK--0OKoVGgZS5N8Sv43-cHe8");
     $client->setAssertionCredentials(new Google_Auth_AssertionCredentials($service_account_name, array('https://www.googleapis.com/auth/analytics'), file_get_contents($keyfile)));
     $this->analytics = new Google_Service_Analytics($client);
     $this->analytics_id = 'ga:72913957';
 }
开发者ID:berlianaputri,项目名称:rps,代码行数:24,代码来源:_GA.php

示例9: index

 public function index()
 {
     $data['baseurl'] = Doo::conf()->APP_URL;
     // include files are automatically parsed and compiled when the parent template file is compiled
     // if you have changes in a include file, just touch or modified & save the parent file to compile it.
     // However, using variable in template as an include filename would not generate any compile file,
     // You would need to compile in manually, <!-- include "variable_include" --> or $this->view()->render('variable_include');
     $data['file'] = 'variable_include';
     $data['nested'] = 'Hello! DooPHP';
     $data['username'] = 'doodemo';
     $data['pwd'] = '1234';
     $data['messages'] = array('Please callback, thanks.', '$1000 cash to earn', 'Supernova photos', 'Weather today is very hot!');
     $data['user'] = array('kee' => 'Lee Kee Seng', 'john' => 'John Smith');
     // used in template as member.total.male, member.titalKids.male
     $data['member'] = array('total' => array('male' => 100, 'female' => 301), 'totalKids' => array('male' => 60, 'female' => 201), 'totalTeen' => array('male' => 40, 'female' => 100));
     if (Doo::cache('front')->testPart('messages', 3600) == false) {
         echo 'Regenerated because cache has expired!';
         $data['usermsg'] = array('leng' => array('Please callback, thanks.', '$1000 cash to earn', 'Supernova photos', 'Weather today is very hot!'), 'john' => array('Hi google', 'I am so happy now!', 'cool day huh?'), 'john2' => array('Hi google', 'I am so happy now!', 'cool day huh?'), 'john3' => array('Hi google', 'I am so happy now!', 'cool day huh?'), 'john4' => array('Hi google', 'I am so happy now!', 'cool day huh?'), 'john5' => array('Hi google', 'I am so happy now!', 'cool day huh?'));
     }
     $data['msgdetails'] = array(array('subject' => 'Cool stuff on my doormat', 'date' => '2009-09-13', 'attachment' => array('pdf' => 'benchmark.pdf', 'doc' => 'readme.doc')), array('subject' => 'Message 2 here hi!', 'date' => '2029-12-03', 'attachment' => array('pdf' => null, 'doc' => null)));
     // Objects can be used in the template too!
     // Used in template as winner.@fullname, winner.@Physical.@height
     Doo::loadModel('Winner');
     $obj = new Winner();
     $obj->fullname = 'Mr. Object';
     $obj->gender = 'unisex';
     $obj->Physical->weight = 562;
     $obj->Physical->height = 180;
     $data['winner'] = $obj;
     $data['winners'] = array();
     for ($i = 0; $i < 4; $i++) {
         $obj = new Winner();
         $obj->fullname = 'Mr. Object ' . $i;
         $obj->gender = 'unisex';
         $obj->Physical->weight = rand(200, 600);
         $obj->Physical->height = rand(150, 200);
         $data['winners'][] = $obj;
     }
     //blog post with tags, template engine using loop with assoc array (Tag)
     Doo::loadModel('Blog');
     Doo::loadModel('Tag');
     $data['posts'] = array();
     for ($i = 0; $i < 3; $i++) {
         $obj = new Blog();
         $obj->title = 'This is a title ' . $i;
         $obj->content = 'Read this content ' . $i;
         $obj->Tag = array();
         for ($g = 0; $g < 3; $g++) {
             $tag = new Tag();
             $tag->name = 'tag' . $g;
             $obj->Tag[] = $tag;
         }
         $data['posts'][] = $obj;
     }
     $this->view()->render('about', $data);
     /* passing a true will enable the engine to process the template and compiled files
        If the template file is newer, then it will be compiled again. */
     # $this->view()->render('about', $data, true);
     /*  This is useful in production mode where DooPHP doesn't auto process it for performance.
         If you want it to force compile everytime, just pass in both as true */
     # $this->view()->render('about', $data, true, true);
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:62,代码来源:MainController.php

示例10: _purgeCache

 /**
  * Delete all the cache on the Model
  * @param array $rmodels Related model names to be deleted from cache
  */
 public static function _purgeCache($rmodels = null)
 {
     if (self::$cacheMode === null || self::$cacheMode == 'file') {
         Doo::cache()->flushAllIn('mdl_' . self::$className);
     } else {
         if (self::$cacheMode == 'php') {
             Doo::cache('php')->flushAllIn('mdl_' . self::$className);
         } else {
             //loop and get the list and delete those start with the Model name, then delete them
             $keysId = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_PATH . 'mdl_' . self::$className;
             if ($keys = Doo::cache(self::$cacheMode)->get($keysId)) {
                 $listOfModelCache = $keys->getArrayCopy();
                 foreach ($listOfModelCache as $k) {
                     //echo '<br>Deleting '. $k .' from memory';
                     Doo::cache(self::$cacheMode)->flush($k);
                 }
             }
             Doo::cache(self::$cacheMode)->flush($keysId);
         }
     }
     if ($rmodels !== null) {
         if (self::$cacheMode === null || self::$cacheMode == 'file') {
             foreach ($rmodels as $r) {
                 Doo::cache()->flushAllIn('mdl_' . get_class($r));
             }
         } else {
             foreach ($rmodels as $r) {
                 //loop and get the list and delete those start with the Model name, then delete them
                 $keysId = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_PATH . 'mdl_' . get_class($r);
                 if ($keys = Doo::cache(self::$cacheMode)->get($keysId)) {
                     $listOfModelCache = $keys->getArrayCopy();
                     foreach ($listOfModelCache as $k) {
                         //echo '<br>Deleting '. $k .' from memory';
                         Doo::cache(self::$cacheMode)->flush($k);
                     }
                     Doo::cache(self::$cacheMode)->flush($keysId);
                 }
             }
         }
     }
 }
开发者ID:garv347,项目名称:swanhart-tools,代码行数:45,代码来源:DooSmartModel.php

示例11: export

 private function export()
 {
     set_time_limit(0);
     $id = Lua::get('id');
     $id = intval($id);
     $db = Lua::get_one("select * from lua_channel where id='{$id}'");
     if (empty($db)) {
         Lua::admin_msg('错误提示', '所要导出的频道不存在');
     }
     Doo::loadHelper('DooFile');
     $fileManager = new DooFile(0777);
     Doo::cache('php')->hashing = false;
     $old_dir = LUA_ROOT . ADMIN_ROOT . '/cache/';
     // 第一步 频道数据
     Doo::cache('php')->set('channel', $db);
     // 第二步 模型数据
     $list = Lua::get_more("select * from lua_model where cid='{$id}'");
     Doo::cache('php')->set('model', $list);
     // 第三步 数据表数据
     if ($list) {
         $dumpsql = '';
         Doo::db()->query("SET SQL_QUOTE_SHOW_CREATE=1");
         foreach ($list as $v) {
             $table = Lua::get_more("select * from lua_model_table where model_id='" . $v['id'] . "'");
             Doo::cache('php')->set('model.' . $v['id'], $table);
             // 第四步 字段数据
             if ($table) {
                 foreach ($table as $k) {
                     $field = Lua::get_more("select * from lua_model_field where model_id='" . $v['id'] . "' and table_id='" . $k['id'] . "'");
                     Doo::cache('php')->set('field.' . $v['id'] . '.' . $k['id'], $field);
                     // 第五步 创建数据表
                     $r = Doo::db()->fetchRow("SHOW CREATE TABLE `" . $k['tablename'] . "`;");
                     $create = str_replace("\"", "\\\"", $r['Create Table']);
                     $dumpsql .= "\r\nDoo::db()->query(\"" . $create . "\");\r\n";
                     // 第六步 导出数据
                     $data = Lua::get_more("select * from " . $k['tablename']);
                     Doo::cache('php')->set('data.' . $k['id'], $data);
                 }
             }
         }
         $fileManager->create($old_dir . 'create.php', '<?php' . $dumpsql . '?>');
     }
     // 第七步 栏目数据
     $list = Lua::get_more("select * from lua_category where systemname='" . $db['path'] . "'");
     Doo::cache('php')->set('cate', $list);
     $list = Lua::get_more("select * from lua_piece where systemname='" . $db['path'] . "'");
     Doo::cache('php')->set('piece', $list);
     // 第八步 打包数据
     $new_dir = LUA_ROOT . $db['path'] . '/cache/update/';
     $fileManager->copy($old_dir, $new_dir);
     // 第九步 删除数据
     $fileManager->delete($old_dir, false);
     Lua::admin_msg('提示信息', '导出成功', './channel.htm');
 }
开发者ID:lianren,项目名称:doophp.cms,代码行数:54,代码来源:__channel.php

示例12: __construct

 /**
  * Class constructor
  *
  * Creating class instance for Gettext:
  * <code>$translator = Doo::translator('Gettext', $this->_basePath . 'languages/en/LC_MESSAGES/en.mo', array());</code>
  *
  * Creating class instance for Csv
  * <code>$translator = Doo::translator('Csv', $this->_basePath . 'languages/en/LC_MESSAGES/main.csv', array('delimiter' => ';',
  *																									   'enclosure' => '"'));</code>
  * For Csv, default delimiter is ";", enclosure '"' and length is 0
  *
  * @param string $adapter Adapter you are using, for example cvs, mo, etc...
  * @param string $data Data needed for translation, or file
  * @param array $options Options for adapter.
  */
 public function __construct($adapter, $data, $options = array())
 {
     $adapter = strtolower($adapter);
     if (!in_array($adapter, $this->_supportedAdapters)) {
         throw new DooTranslatorException($adapter . " is not supported by DooTranslator, supported types are: " . implode(', ', $this->_supportedAdapters));
     }
     $this->_setAdapter($adapter);
     if ($data == null) {
         throw new DooTranslatorException("Data not set!");
     }
     $this->_options = $options;
     // set cache
     if (isset($this->_options['cache'])) {
         if (!in_array($this->_options['cache'], $this->_supportedCacheTypes)) {
             throw new DooTranslatorException($this->_options['cache'] . " is unsuported cache type, supported cache types are: " . implode(', ', $this->_supportedCacheTypes));
         } else {
             switch ($this->_options['cache']) {
                 case "apc":
                     $this->_cache = Doo::cache('apc');
                     break;
                 case "php":
                     $this->_cache = Doo::cache('php');
                     break;
                 case "xcache":
                     $this->_cache = Doo::cache('xcache');
                     break;
                 case "eaccelerator":
                     $this->_cache = Doo::cache('eaccelerator');
                     break;
                 case "file":
                     if (isset($this->_options['path'])) {
                         $this->_cache = new DooFileCache($this->_options['path']);
                     } else {
                         throw new DooTranslatorException("Cache directory is not set, please add path in options.");
                     }
                     break;
             }
             $this->_cachedName = md5($data);
         }
     }
     // load data
     $this->_loadData($data);
 }
开发者ID:garv347,项目名称:swanhart-tools,代码行数:58,代码来源:DooTranslator.php

示例13: cfile

 public function cfile()
 {
     return Doo::cache('php');
 }
开发者ID:aising,项目名称:ding,代码行数:4,代码来源:KVCache.php

示例14: getPartApc

 public function getPartApc($id, $secondsCache = 3600)
 {
     if (false !== ($data = Doo::cache("apc")->get($id))) {
         echo $data;
         return true;
     }
     return false;
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:8,代码来源:DooFrontCache.php

示例15: cache

 /**
  * Returns the cache singleton, shorthand to Doo::cache()
  * @return DooFileCache|DooFrontCache|DooApcCache|DooMemCache|DooXCache|DooEAcceleratorCache
  */
 public function cache($cacheType = 'file')
 {
     return Doo::cache($cacheType);
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:8,代码来源:deploy.php


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