コード例 #1
0
ファイル: ServerStatus.php プロジェクト: mmorpg2015/ghtweb5
 public function init()
 {
     if (($data = cache()->get(CacheNames::SERVER_STATUS)) === FALSE) {
         if (config('server_status.allow') == 1) {
             $data['content'] = array();
             $data['totalOnline'] = 0;
             $criteria = new CDbCriteria(array('select' => 't.name, t.id, t.fake_online, t.ip, t.port', 'scopes' => array('opened'), 'with' => array('ls' => array('select' => 'ls.ip, ls.port, ls.name', 'scopes' => array('opened')))));
             $gsList = Gs::model()->findAll($criteria);
             if ($gsList) {
                 foreach ($gsList as $gs) {
                     try {
                         $l2 = l2('gs', $gs->id)->connect();
                         // Кол-во игроков
                         $online = $l2->getDb()->createCommand("SELECT COUNT(0) FROM `characters` WHERE `online` = 1")->queryScalar();
                         // Fake online
                         if (is_numeric($gs->fake_online) && $gs->fake_online > 0) {
                             $online += Lineage::fakeOnline($online, $gs->fake_online);
                         }
                         $data['content'][$gs->id] = array('gs_status' => Lineage::getServerStatus($gs->ip, $gs->port), 'ls_status' => isset($gs->ls) ? Lineage::getServerStatus($gs->ls->ip, $gs->ls->port) : 'offline', 'online' => $online, 'gs' => $gs);
                         $data['totalOnline'] += $online;
                     } catch (Exception $e) {
                         $data[$gs->id]['error'] = $e->getMessage();
                     }
                 }
             }
             if (config('server_status.cache') > 0) {
                 cache()->set(CacheNames::SERVER_STATUS, $data, config('server_status.cache') * 60);
             }
         }
     }
     app()->controller->renderPartial('//server-status', $data);
 }
コード例 #2
0
ファイル: yql.php プロジェクト: SandyS1/presentations
function yql($q, $fmt = 'xml')
{
    $yql = "http://query.yahooapis.com/v1/public/yql?q=";
    $env = 'store://datatables.org/alltableswithkeys';
    $x = simplexml_load_file(cache($yql . urlencode($q) . "&format={$fmt}&env=" . urlencode($env)));
    return $x;
}
コード例 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $page = cache('pages')->filter(function ($page) {
         return $page->url == "events";
     })->first();
     // Delete all record first
     DB::table('layout_events')->truncate();
     $photoType = ['abstract', "animal", "business", "cats", "city", "food", "nightlife", "fashion", "people", "nature", "sports", "technics", "transport"];
     $months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
     $catList = ['Dance', "Drama", "Sport", "Party"];
     foreach ($months as $month) {
         for ($day = 1; $day <= (int) date('t', strtotime("2015-{$month}")); $day++) {
             $number = rand(0, 5);
             if ($day < 10) {
                 $date = "0{$day}";
             } else {
                 $date = $day;
             }
             if ($number > 0) {
                 for ($i = 0; $i < $number; $i++) {
                     $type = $photoType[rand(0, 12)];
                     $cat = $catList[rand(0, 3)];
                     $startDate = Carbon::create(2015, $month, $date);
                     $endDate = Carbon::create(2015, $month, $date)->addDays(rand(1, 5));
                     $data = ['lang_id' => 1, 'meta_title' => "Event {$i} on day {$day}", 'meta_description' => "Lorem ipsum dolor sit amet, ea elit dolore urbanitas quo. Est assum cetero ei. Eam semper docendi id. Mucius doming.", 'page_id' => $page->id, 'content_identifier' => "event_seeder_{$month}-{$day}-{$i}", 'active' => 1, 'eventStartDate' => $startDate->format("Y-m-d h:i:s"), 'eventEndDate' => $endDate->format("Y-m-d h:i:s"), 'address' => "hong Kong", 'image1' => "http://lorempixel.com/380/300/{$type}", 'image2' => "http://lorempixel.com/380/300/{$type}", 'image3' => "http://lorempixel.com/380/300/{$type}", 'image4' => "http://lorempixel.com/380/300/{$type}", 'summary' => "this is the summary for a {$cat} event {$i} on {$date} {$month}", 'detail' => "Lorem ipsum dolor sit amet, consectetur adipisicing elit. A ad aliquam aperiam, consectetur debitis delectus dicta distinctio dolorum ea enim non odio placeat, quam quibusdam unde vero, voluptas voluptatibus? Accusantium alias amet, autem consectetur delectus dicta dignissimos esse id incidunt inventore ipsam maxime, provident quaerat quisquam quod sunt suscipit veritatis voluptas? A animi aperiam architecto dignissimos ducimus exercitationem, explicabo facilis id iste itaque labore maxime modi provident, quos, ratione recusandae repellendus sunt tenetur ut vero? Adipisci alias aliquam aliquid aperiam cumque delectus dignissimos dolorem doloribus et facere harum itaque mollitia nobis provident quia, repudiandae sint sit soluta temporibus vitae voluptatibus.", 'cat' => $cat];
                     DB::table('layout_events')->insert($data);
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: ForumThreads.php プロジェクト: mmorpg2015/ghtweb5
 public function init()
 {
     $data = array('content' => array(), 'error' => Yii::t('main', 'Модуль отключен.'));
     if (config('forum_threads.allow') == 1) {
         $data = cache()->get(CacheNames::FORUM_THREADS);
         if ($data === FALSE) {
             $data = array();
             try {
                 // Подключаюсь к БД
                 $this->db = Yii::createComponent(array('class' => 'CDbConnection', 'connectionString' => 'mysql:host=' . config('forum_threads.db_host') . ';port=' . config('forum_threads.db_port') . ';dbname=' . config('forum_threads.db_name'), 'enableProfiling' => YII_DEBUG, 'enableParamLogging' => TRUE, 'username' => config('forum_threads.db_user'), 'password' => config('forum_threads.db_pass'), 'charset' => 'utf8', 'emulatePrepare' => TRUE, 'tablePrefix' => config('forum_threads.prefix')));
                 app()->setComponent('ForumThreadsDb', $this->db);
                 $forumType = config('forum_threads.type');
                 if (method_exists($this, $forumType)) {
                     $data['content'] = $this->{$forumType}();
                     foreach ($data['content'] as $k => $v) {
                         $data['content'][$k]['user_link'] = $this->getUserLink($v['starter_id'], $v['starter_name']);
                         $data['content'][$k]['theme_link'] = $this->getForumLink($v['id_topic'], $v['title'], $v['id_forum']);
                         $data['content'][$k]['start_date'] = $this->getStartDate($v['start_date']);
                     }
                     if (config('forum_threads.cache')) {
                         cache()->set(CacheNames::FORUM_THREADS, $data, config('forum_threads.cache') * 60);
                     }
                 } else {
                     $data['error'] = Yii::t('main', 'Метод для обработки форума: :type не найден.', array(':type' => '<b>' . $forumType . '</b>'));
                 }
             } catch (Exception $e) {
                 $data['error'] = $e->getMessage();
             }
         }
     }
     app()->controller->renderPartial('//forum-threads', $data);
 }
コード例 #5
0
ファイル: AuthController.php プロジェクト: hiproz/mincms
 /**
  * 用户组绑定权限
  */
 public function actionIndex($id)
 {
     $id = (int) $id;
     $model = Group::model()->findByPk($id);
     if ($model->access) {
         foreach ($model->access as $g) {
             $access[] = $g->access_id;
         }
     }
     $cache = cache('auth_controller_file');
     if (!$cache) {
         $d = $this->_get_modules(\Yii::getPathOfAlias('application.modules'));
         if ($d) {
             Access::generate($d);
         }
         DirHelper::$kep_list_file = false;
         cache('auth_controller_file', true);
     }
     $rows = DB::all('access', array('select' => "id,name,pid"));
     foreach ($rows as $v) {
         $out[$v['id']] = $v;
     }
     $rows = ArrHelper::_tree_id($rows);
     if ($_POST) {
         $auth = $_POST['auth'];
         GroupAccess::saveAccess($id, $auth);
         cache('acl', false);
         flash('success', __('set access success'));
         $this->redirect(url('admin/auth/index', array('id' => $id)));
     }
     return $this->render('index', array('rows' => $rows, 'out' => $out, 'model' => $model, 'id' => $id, 'access' => $access));
 }
コード例 #6
0
ファイル: LanguageController.php プロジェクト: hiproz/mincms
 public function actionUpdate()
 {
     if ($_POST) {
         cache('defaultDBLanguge', false);
     }
     $this->render('update');
 }
コード例 #7
0
ファイル: DefaultController.php プロジェクト: hiproz/mincms
 public function actionIndex()
 {
     $rows = CDB()->from('configs')->queryAll();
     if ($rows) {
         foreach ($rows as $v) {
             $data[$v['name']] = $v['body'];
         }
     }
     if ($_POST['config']) {
         $config = $_POST['config'];
         if ($config) {
             CDB()->update('configs', array('body' => ""));
             foreach ($config as $k => $v) {
                 $row = CDB()->from('configs')->where("name=:name", array(':name' => $k))->queryRow();
                 if (!$row) {
                     CDB()->insert('configs', array('name' => $k, 'body' => $v));
                 } else {
                     CDB()->update('configs', array('body' => $v), "name=:name", array(':name' => $k));
                 }
             }
             flash('success', __('success'));
             cache('config', false);
             $this->refresh();
         }
     }
     $this->render('index', $data);
 }
コード例 #8
0
ファイル: cache.php プロジェクト: piter65/spilldec
function cacheGet($k)
{
    global $cacheHost;
    $v = cache($cacheHost, array('act' => 'get', 'key' => $k));
    //echo "(cacheGet($k) returning ".($v === null ? "null" : $v).")\n";
    return $v;
}
コード例 #9
0
ファイル: Content.class.php プロジェクト: jyht/v5
 public function add($data)
 {
     $ContentModel = ContentModel::getInstance($this->_mid);
     if (!isset($this->_model[$this->_mid])) {
         $this->error = '模型不存在';
     }
     $ContentInputModel = new ContentInputModel($this->_mid);
     $insertData = $ContentInputModel->get($data);
     if ($insertData == false) {
         $this->error = $ContentInputModel->error;
         return false;
     }
     if ($ContentModel->create($insertData)) {
         $result = $ContentModel->add($insertData);
         $aid = $result[$ContentModel->table];
         $this->editTagData($aid);
         M('upload')->where(array('uid' => $_SESSION['uid']))->save(array('state' => 1));
         //============记录动态
         $DMessage = "发表了文章:<a target='_blank' href='" . U('Index/Index/content', array('mid' => $insertData['mid'], 'cid' => $insertData['cid'], 'aid' => $aid)) . "'>{$insertData['title']}</a>";
         addDynamic($_SESSION['uid'], $DMessage);
         //内容静态
         $Html = new Html();
         $Html->content($this->find($aid));
         $categoryCache = cache('category');
         $cat = $categoryCache[$insertData['cid']];
         $Html->relation_category($insertData['cid']);
         $Html->index();
         return $aid;
     } else {
         $this->error = $ContentModel->error;
         return false;
     }
 }
コード例 #10
0
ファイル: UserControl.class.php プロジェクト: jyht/v5
 public function del()
 {
     if (IS_POST) {
         $uid = Q('uid', 0, 'intval');
         //删除文章
         if (Q('post.delcontent')) {
             $ModelCache = cache('model');
             foreach ($ModelCache as $model) {
                 $contentModel = ContentModel::getInstance($model['mid']);
                 $contentModel->where(array('uid' => $uid))->del();
             }
         }
         //删除评论
         if (Q('post.delcomment')) {
             M('comment')->where(array('uid' => $uid))->del();
         }
         //删除附件
         if (Q('post.delupload')) {
             M('upload')->where(array('uid' => $uid))->del();
         }
         //删除用户
         M('user')->del($uid);
         $this->success('删除成功...');
     } else {
         $uid = Q("uid", 0, "intval");
         $field = M('user')->find($uid);
         $this->assign('field', $field);
         $this->display();
     }
 }
コード例 #11
0
ファイル: Locker.php プロジェクト: locphp/rsf
 private static function cmd($cmd, $name, $ttl = 0)
 {
     if ('file' == getini('cache/cacher')) {
         return self::dblock($cmd, $name, $ttl);
     }
     return cache($cmd, 'process_' . $name, time(), $ttl);
 }
コード例 #12
0
ファイル: partial.php プロジェクト: hiromi2424/PartialHelper
 function render($name, $params = array(), $loadHelpers = false)
 {
     $view =& ClassRegistry::getObject('view');
     $file = $plugin = $key = null;
     if (isset($params['cache'])) {
         $expires = '+1 day';
         if (is_array($params['cache'])) {
             $expires = $params['cache']['time'];
             $key = Inflector::slug($params['cache']['key']);
         } elseif ($params['cache'] !== true) {
             $expires = $params['cache'];
             $key = implode('_', array_keys($params));
         }
         if ($expires) {
             $cacheFile = 'partial_' . $key . '_' . Inflector::slug($name);
             $cache = cache('views' . DS . $cacheFile, null, $expires);
             if (is_string($cache)) {
                 return $cache;
             }
         }
     }
     $buf = explode(DS, $name);
     $buf[count($buf) - 1] = '_' . $buf[count($buf) - 1];
     $name = implode(DS, $buf);
     if ($partial = $view->render($name, false)) {
         if (isset($params['cache']) && isset($cacheFile) && isset($expires)) {
             cache('views' . DS . $cacheFile, $partial, $expires);
         }
         return $partial;
     }
     if (Configure::read() > 0) {
         return "Not Found: " . str_replace(DS . DS, DS, $view->viewPath . DS . $name);
     }
 }
コード例 #13
0
ファイル: TableControl.class.php プロジェクト: jyht/v5
 public function contentReplace()
 {
     if (IS_POST) {
         $WHERE = !empty($_POST['replacewhere']) ? " WHERE {$_POST['replacewhere']}" : '';
         $VALUE = "replace({$_POST['field']},'{$_POST['searchcontent']}','{$_POST['replacecontent']}')";
         $sql = "UPDATE " . $_POST['table'] . " SET {$_POST['field']}={$VALUE} {$WHERE}";
         if (M()->exe($sql)) {
             $this->success('替换成功!');
         } else {
             $this->error('替换失败...');
         }
     } else {
         $tableCache = cache('table');
         if (!$tableCache) {
             $Model = M();
             $tableInfo = $Model->getTableInfo();
             $tables = $tableInfo['table'];
             cache('table', $tables);
             $tableCache = $tables;
         }
         $this->assign("tablesJson", json_encode($tableCache));
         $this->assign('tables', $tableCache);
         $this->display();
     }
 }
コード例 #14
0
ファイル: form.inc.php プロジェクト: sandom123/king400
/**
 * 推荐字段类型表单组合处理
 * @param type $field 字段名
 * @param type $value 字段内容
 * @param type $fieldinfo 字段配置
 * @return string
 */
function posid($field, $value, $fieldinfo)
{
    //扩展配置
    $setting = unserialize($fieldinfo['setting']);
    //推荐位缓存
    $position = cache('Position');
    if (empty($position)) {
        return '';
    }
    $array = array();
    foreach ($position as $_key => $_value) {
        //如果有设置模型,检查是否有该模型
        if ($_value['modelid'] && !in_array($this->modelid, explode(',', $_value['modelid']))) {
            continue;
        }
        //如果设置了模型,又设置了栏目
        if ($_value['modelid'] && $_value['catid'] && !in_array($this->catid, explode(',', $_value['catid']))) {
            continue;
        }
        //如果设置了栏目
        if ($_value['catid'] && !in_array($this->catid, explode(',', $_value['catid']))) {
            continue;
        }
        $array[$_key] = $_value['name'];
    }
    $posids = array();
    if (ACTION_NAME == 'edit') {
        $result = M('PositionData')->where(array('id' => $this->id, 'modelid' => $this->modelid))->getField("posid,id,catid,posid,module,modelid,thumb,data,listorder,expiration,extention,synedit");
        $posids = implode(',', array_keys($result));
    } else {
        $posids = $setting['defaultvalue'];
    }
    return "<input type='hidden' name='info[{$field}][]' value='-1'>" . \Form::checkbox($array, $posids, "name='info[{$field}][]'", '', $setting['width']);
}
コード例 #15
0
ファイル: Local.class.php プロジェクト: sandom123/king400
 /**
  * 架构函数
  * @param array $options 配置参数
  * @access public
  */
 function __construct($options = array())
 {
     //网站配置
     $this->config = cache("Config");
     $options = array_merge(array('userid' => 0, 'groupid' => 8, 'isadmin' => 0, 'catid' => 0, 'module' => 'content ', 'watermarkenable' => $this->config['watermarkenable'], 'thumb' => false, 'time' => time(), 'dateFormat' => 'Y/m'), $options);
     $this->options = $options;
     //附件访问地址
     $this->options['sitefileurl'] = $this->config['sitefileurl'];
     //附件存放路径
     $this->options['uploadfilepath'] = C('UPLOADFILEPATH');
     //允许上传的附件大小
     if (empty($this->options['uploadmaxsize'])) {
         $this->options['uploadmaxsize'] = $this->options['isadmin'] ? (int) $this->config['uploadmaxsize'] * 1024 : (int) $this->config['qtuploadmaxsize'] * 1024;
     }
     //允许上传的附件类型
     if (empty($this->options['uploadallowext'])) {
         $this->options['uploadallowext'] = $this->options['isadmin'] ? explode("|", $this->config['uploadallowext']) : explode("|", $this->config['qtuploadallowext']);
     }
     //上传目录
     $this->options['savePath'] = D('Attachment/Attachment')->getFilePath($this->options['module'], $this->options['dateFormat'], $this->options['time']);
     //如果生成缩略图是否移除原图
     $this->options['thumbRemoveOrigin'] = false;
     $this->handler = new \UploadFile();
     //设置上传类型
     $this->handler->allowExts = $this->options['uploadallowext'];
     //设置上传大小
     $this->handler->maxSize = $this->options['uploadmaxsize'];
     //设置本次上传目录,不存在时生成
     $this->handler->savePath = $this->options['savePath'];
 }
コード例 #16
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     init_yf();
     cache()->flush();
     $text = 'Cache flushed successfully';
     $output->writeln($text);
 }
コード例 #17
0
 /**
  * Очистка кэша
  */
 public function actionClearCache()
 {
     if (request()->isAjaxRequest) {
         cache()->flush();
         echo Yii::t('main', 'Кэш удален');
     }
 }
コード例 #18
0
ファイル: functions.php プロジェクト: jyht/v5
/**
 * 获得栏目
 * @param int $cid 栏目cid
 * @param int $type 1 子栏目  2 父栏目
 * @param int $returnType 1 只有cid  2 内容
 */
function getCategory($cid, $type = 1, $return = 1)
{
    $cache = cache('category');
    $cat = $catid = array();
    if ($type == 1) {
        //子栏目
        $cat = Data::channelList($cache, $cid);
    } else {
        if ($type == 2) {
            //父栏目
            $cat = parentChannel($cache, $cid);
        }
    }
    if ($return == 1) {
        //返回cid
        foreach ($cat as $c) {
            $catid[] = $c['cid'];
        }
        $catid[] = $cid;
        return $catid;
    } else {
        if ($return == 2) {
            //返回所有栏目数据
            $cat[] = $cache[$cid];
        }
    }
    return $cat;
}
コード例 #19
0
function clean_terms($terms)
{
    # if we've got a cached version of the results from this function use it...
    $id = md5(implode(',', $terms));
    $cached = get_cache($id);
    if ($cached) {
        return unserialize($cached);
    }
    # go through the terms in sequence to see what the counts with non-duplicated posts are...
    $posts_seen = array();
    foreach ($terms as $term => $freq) {
        $term = mysql_escape_string($term);
        $query = "SELECT DISTINCT post_id FROM terms WHERE term='{$term}'";
        $results = mysql_query($query);
        while ($row = mysql_fetch_assoc($results)) {
            $post_id = $row['post_id'];
            if ($posts_seen[$post_id]) {
                $terms[$term]--;
                if ($terms[$term] <= 0) {
                    unset($terms[$term]);
                }
            }
            $posts_seen[$post_id] = true;
        }
    }
    arsort($terms);
    # cache results
    $cached = serialize($terms);
    cache($id, $cached);
    return $terms;
}
コード例 #20
0
ファイル: function.php プロジェクト: hiproz/mincms
 /**
 * 后台菜单
 <?php $menus = menu_function::admin();
         foreach($menus as $v){ 
         ?>
         <li <?php if(Helper::activeMenu(substr($v->url,0,strrpos($v->url,'/')))){?>
         		class="active"<?php }?> >
         		<a href="<?php echo url($v->url);?>">
         			<i class="fa fa-dashboard"></i><?php echo __($v->name);?>
         		</a>
         </li>
         <?php }?>
 */
 static function admin()
 {
     if (!cache('menus')) {
         cache('menus', self::menu());
     }
     return cache('menus');
 }
コード例 #21
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $this->role->users()->chunk(50, function (Collection $users) {
         $users->each(function (Model $user) {
             cache()->forget(Trust::PERMISSION_KEY . ':' . $user->getKey());
         });
     });
 }
コード例 #22
0
 protected function _initialize()
 {
     parent::_initialize();
     $config = cache('Config');
     $this->appid = $config['wxappid'];
     $this->appsecret = $config['wxappsecret'];
     $this->get_user_openid();
 }
コード例 #23
0
ファイル: Language.php プロジェクト: xavierauana/events
 /**
  * @return \App\Contracts\Repositories\LanguageInterface
  */
 public function getDefaultLanguage()
 {
     $object = $this;
     $language = cache()->rememberForever('default_language', function () use($object) {
         return $object->whereDefault(1)->first();
     });
     return $language;
 }
コード例 #24
0
ファイル: Builder.php プロジェクト: donny5300/translations
 /**
  * Builder constructor.
  */
 public function __construct()
 {
     $this->groupRepo = app(GroupRepo::class);
     $this->nameRepo = app(NameRepo::class);
     $this->config = config('translations');
     $this->cache = cache();
     $this->translations = $this->setTranslations();
 }
コード例 #25
0
ファイル: db.class.php プロジェクト: nuxodin/shwups-cms-v4
 function __construct($conn, $user, $pass)
 {
     $this->PDO = new \PDO($conn, $user, $pass);
     $this->PDO->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
     $this->PDO->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
     $this->PDO->exec('SET NAMES utf8');
     $this->Cache = cache($conn . '_dbTables');
 }
コード例 #26
0
ファイル: CacheControl.class.php プロジェクト: jyht/v5
 public function updateCache()
 {
     $ActionCache = F('updateCache');
     if ($ActionCache) {
         $action = array_shift($ActionCache);
         F('updateCache', $ActionCache);
         switch ($action) {
             case "Config":
                 $Model = K("Config");
                 $Model->updateCache();
                 $this->success('网站配置更新完毕...', U("updateCache"), 0);
                 break;
             case "Model":
                 $Model = K("Model");
                 $Model->updateCache();
                 $this->success('模型更新完毕...', U("updateCache"), 0);
                 break;
             case "Field":
                 $Model = new ModelFieldModel(1);
                 $ModelCache = cache("model");
                 foreach ($ModelCache as $mid => $data) {
                     $Model->updateCache($mid);
                 }
                 $this->success('字段更新完毕...', U("updateCache"), 0);
                 break;
             case "Category":
                 $Model = K("Category");
                 $Model->updateCache();
                 $this->success('栏目更新完毕...', U("updateCache"), 0);
                 break;
             case "Node":
                 $Model = K("Node");
                 $Model->updateCache();
                 $this->success('权限节点更新完毕...', U("updateCache"), 0);
                 break;
             case "Table":
                 cache('table', null);
                 $this->success('数据表更新完毕...', U("updateCache"), 0);
                 break;
             case "Role":
                 $Model = K("Role");
                 $Model->updateCache();
                 $this->success('角色更新完毕...', U("updateCache"), 0);
                 break;
             case "Flag":
                 $Model = new FlagModel(1);
                 $ModelCache = cache("model");
                 foreach ($ModelCache as $mid => $data) {
                     $Model->updateCache($mid);
                 }
                 $this->success('Flag更新完毕...', U("updateCache"), 0);
                 break;
         }
     } else {
         Dir::del('temp');
         $this->success('缓存更新成功...', U('index'), 0);
     }
 }
コード例 #27
0
ファイル: sidebar.class.php プロジェクト: jayxtt999/me
 /**
  * 初始化 检索缓存
  * @param $callback
  * @param $data
  * @return mixed|void
  */
 public static function init($callback, $data)
 {
     if (cache('sidebar_' . $callback)) {
         return cache('sidebar_' . $callback);
     } else {
         cache('sidebar_' . $callback, self::$callback($data));
         return self::$callback($data);
     }
 }
コード例 #28
0
ファイル: Mysql.php プロジェクト: NukaCode/dasher
 public function __construct(Status $status, Verify $verify)
 {
     $this->version = cache()->remember('mysql.version', 120, function () use($verify) {
         return $verify->mysql();
     });
     $this->status = cache()->remember('mysql.status', 5, function () use($status) {
         return $status->mysql();
     });
 }
コード例 #29
0
ファイル: UtilsTest.php プロジェクト: bephp/utils
 /**
  * @depends testConfigInit
  */
 public function testCache($config)
 {
     $this->assertNull(cache('testcachekey'));
     cache('testcachekey', 'testcachevalue', 1);
     $this->assertEquals('testcachevalue', cache('testcachekey'));
     $this->assertNull(mcache('testcachekey'));
     mcache('testcachekey', 'testcachevalue', 1);
     $this->assertEquals('testcachevalue', mcache('testcachekey'));
 }
コード例 #30
0
 public function fetchAll()
 {
     $categorylist = cache('category');
     if (!$categorylist) {
         $this->updatecache();
         $categorylist = $this->fetchAll();
     }
     return $categorylist;
 }