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


PHP FileCache::get方法代码示例

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


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

示例1: testExpire

 public function testExpire()
 {
     $key = uniqid();
     $c = new FileCache($this->file);
     $this->assertTrue($c->set($key, ['bar' => ['baz']], 1));
     $this->assertEquals(['bar' => ['baz']], $c->get($key));
     $this->assertTrue($c->expires($key) <= time() + 1);
     sleep(2);
     $this->assertNull($c->get($key));
 }
开发者ID:0x20h,项目名称:phloppy,代码行数:10,代码来源:FileCacheTest.php

示例2: FileCache

 function testSet_expire()
 {
     $cache = new FileCache();
     $cache->set($this->name, $this->data, new DateTime('-1 day'));
     $result = $cache->get($this->name);
     $this->assertSame(null, $result);
 }
开发者ID:hidetobara,项目名称:voices,代码行数:7,代码来源:TestFileCache.php

示例3: __construct

 public function __construct()
 {
     $http = new swoole_http_server('127.0.0.1', '9999');
     $http->set(array('reactor_num' => 1, 'worker_num' => 2, 'backlog' => 128, 'max_request' => 500, 'heartbeat_idle_time' => 30, 'heartbeat_check_interval' => 10, 'dispatch_mode' => 3));
     $http->on('request', function ($request, $response) {
         $request->get = isset($request->get) ? $request->get : [];
         $request->post = isset($request->post) ? $request->post : [];
         $request->cookie = isset($request->cookie) ? $request->cookie : [];
         $request->files = isset($request->files) ? $request->files : [];
         $request->server = isset($request->server) ? $request->server : [];
         if ($request->server['request_uri'] == '/favicon.ico') {
             $response->end();
             return;
         }
         $cache_dir = \Config::get('cron::cache_dir') ?: 'runtime/cron';
         $pid = \FileCache::get('pid', $cache_dir);
         $work_ids = \FileCache::get('work_ids', $cache_dir);
         ob_start();
         require __DIR__ . "/View/console.php";
         $output = ob_get_contents();
         ob_end_clean();
         $response->status(200);
         $response->end($output);
         return;
     });
     $this->http = $http;
 }
开发者ID:fucongcong,项目名称:framework,代码行数:27,代码来源:CronAdmin.php

示例4: get

 static function get($key)
 {
     if (extension_loaded("memcached")) {
         $memcache = self::memcacheInit();
         return $memcache->get($key);
     } else {
         return FileCache::get($key);
     }
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:9,代码来源:SiteCache.php

示例5: init

 public function init()
 {
     $sqlDir = __ROOT__ . "app/sql/";
     $lock = \FileCache::isExist("sql.lock", $sqlDir);
     if ($lock) {
         $this->fileList = \FileCache::get("sql.lock", $sqlDir);
     }
     $this->ListSql($sqlDir);
     \FileCache::set("sql.lock", $this->fileList, $sqlDir);
 }
开发者ID:fucongcong,项目名称:framework,代码行数:10,代码来源:SqlMigrateCommand.php

示例6: init

 public function init()
 {
     $sqlDir = __ROOT__ . "app/sql/";
     $lock = \FileCache::isExist("sql.lock", $sqlDir);
     if ($lock) {
         $this->fileList = \FileCache::get("sql.lock", $sqlDir);
     }
     $this->ListSql($sqlDir);
     //清除lock
     $clean = new SqlCleanCommand();
     $clean->init();
 }
开发者ID:fucongcong,项目名称:framework,代码行数:12,代码来源:SqlRollBackCommand.php

示例7: stop

 /**
  * 停止队列服务
  *
  */
 public function stop()
 {
     $pid = $this->getPid();
     if (!empty($pid) && $pid) {
         if (swoole_process::kill($pid, 0)) {
             //杀掉worker进程
             foreach (\FileCache::get('work_ids', $this->logDir . "/") as $work_id) {
                 swoole_process::kill($work_id, SIGTERM);
             }
         }
     }
 }
开发者ID:fucongcong,项目名称:framework,代码行数:16,代码来源:Bear.php

示例8: handle

 function handle()
 {
     $cache = new FileCache();
     $info = $cache->get(self::CACHE_KEY);
     if (!is_array($info)) {
         $shokos = new VolatileTwitShokos();
         $info = $shokos->bestTalkInfo();
         $cache->set(self::CACHE_KEY, $info, new DateTime("+30 min"));
     }
     $this->assign('rate', $info['rate']);
     $this->assign('text', $info['text']);
     $this->assign('status', 'ok');
 }
开发者ID:hidetobara,项目名称:VolatileTwit,代码行数:13,代码来源:talk.php

示例9: run

 function run()
 {
     $cache = new FileCache();
     $box = $cache->get(self::TWITTER_CRAWL_KEY);
     if (!is_array($box)) {
         $box = array();
     }
     $api = new TwitterApi(HIDETOBARA_OAUTH_KEY, HIDETOBARA_OAUTH_SECRET);
     $a = $api->getHomeTimeline($box);
     $storage = new TwitterStorage();
     $storage->retrieveStatus($a);
     $storage->saveStatusByDate(LOG_DIR . "status/");
     $box = $storage->updateUserCache($box);
     $cache->set(self::TWITTER_CRAWL_KEY, $box);
 }
开发者ID:hidetobara,项目名称:VolatileTwit,代码行数:15,代码来源:crawl_status.php

示例10: search

 function search()
 {
     $cacheData = FileCache::get('__cache__' . $this->keyword);
     if (!$cacheData) {
         $url = $this->queryUrl . urlencode($this->keyword);
         $request_result = $this->request($url);
         $json = json_decode($request_result);
         $searchData = $json->data;
         if (count($searchData) > 0) {
             FileCache::set('__cache__' . $this->keyword, $searchData, 24 * 60 * 60);
         }
     } else {
         $searchData = $cacheData;
     }
     if (count($searchData) > 0) {
         $codeArray = array();
         foreach ($searchData as $value) {
             $d = explode('~', $value);
             if (preg_match('/(\\..*)$/', $d[1], $re)) {
                 $d[1] = str_replace($re[1], "", $d[1]);
             }
             if ($d[0] == 'us') {
                 $d[1] = strtoupper($d[1]);
             }
             $dCode = $d[0] . $d[1];
             if ($d[0] == 'hk') {
                 $dCode = 'r_' . $dCode;
             }
             if ($d[0] == 'jj') {
                 $dCode = 's_' . $dCode;
             }
             array_push($codeArray, $dCode);
         }
         $qt = new StockQt();
         $qt->fetchQt(implode(',', $codeArray));
         foreach ($searchData as $key => $value) {
             $stock = new Stock($value, $qt);
             $this->result($key, $stock->getLink(), $stock->getTitle(), $stock->getSubTitle(), null);
         }
     } else {
         $this->lastPlaceholder();
     }
 }
开发者ID:obstschale,项目名称:AlfredWorkflow.com,代码行数:43,代码来源:stock.php

示例11: search

 function search()
 {
     $qtData = FileCache::get($this->keyword);
     if (!$qtData) {
         $url = $this->queryUrl . urlencode($this->keyword);
         $request_result = $this->request($url);
         $json = json_decode($request_result);
         $qtData = $json->data;
     }
     if (count($qtData) > 0) {
         FileCache::set($this->keyword, $qtData);
         foreach ($qtData as $key => $value) {
             $stock = new Stock($value);
             $this->result($key, $stock->getLink(), $stock->getTitle(), $stock->getSubTitle(), null);
         }
     } else {
         $this->lastPlaceholder();
     }
 }
开发者ID:note4me,项目名称:AlfredWorkflow.com,代码行数:19,代码来源:stock.php

示例12: content_key_for_mtime_key

 private function content_key_for_mtime_key($key, $work_units)
 {
     if (!(defined('SACY_USE_CONTENT_BASED_CACHE') && SACY_USE_CONTENT_BASED_CACHE)) {
         return $key;
     }
     $cache_key = 'ck-for-mkey-' . $key;
     $ck = $this->fragment_cache->get($cache_key);
     if (!$ck) {
         $ck = "";
         foreach ($work_units as $f) {
             $ck = md5($ck . md5_file($f['file']));
             foreach ($f['additional_files'] as $af) {
                 $ck = md5($ck . md5_file($af));
             }
         }
         $ck = "{$ck}-content";
         $this->fragment_cache->set($cache_key, $ck);
     }
     return $ck;
 }
开发者ID:fjg,项目名称:sacy,代码行数:20,代码来源:sacy.php

示例13: util_assertNotMirror

<?php

require_once "../../phplib/util.php";
util_assertNotMirror();
util_assertNotLoggedIn();
$loginType = util_getRequestParameter('loginType');
$nickOrEmail = util_getRequestParameter('nickOrEmail');
$password = util_getRequestParameter('password');
$nick = util_getRequestParameter('nick');
$randString = util_getRequestParameter('randString');
$data = FileCache::get($randString);
if (!$data) {
    FlashMessage::add('A apărut o eroare la autentificare. Vă rugăm încercați din nou.');
} else {
    if ($loginType == 0) {
        $user = Model::factory('User')->where('password', md5($password))->where_raw("(email = '{$nickOrEmail}' or nick = '{$nickOrEmail}')")->find_one();
        if (!$user) {
            FlashMessage::add('Numele de utilizator sau parola sunt incorecte.');
        } else {
            if ($user->identity) {
                FlashMessage::add('Acest utilizator a fost deja revendicat de un alt OpenID.');
            } else {
                session_login($user, $data);
            }
        }
    } else {
        $openidNick = $loginType == 1 ? $data['fullname'] : ($loginType == 2 ? $data['nickname'] : $nick);
        $user = User::get_by_nick($openidNick);
        if ($user) {
            FlashMessage::add('Acest nume de utilizator este deja luat.');
        } else {
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:revendicare.php

示例14: util_assertNotMirror

<?php

require_once "../../phplib/util.php";
util_assertNotMirror();
util_assertNotLoggedIn();
$token = util_getRequestParameter('token');
$identity = util_getRequestParameter('identity');
$pt = PasswordToken::get_by_token($token);
$data = FileCache::get($identity);
if (!$pt) {
    FlashMessage::add('Ați introdus un cod de recuperare incorect.');
} else {
    if ($pt->createDate < time() - 24 * 3600) {
        FlashMessage::add('Codul de recuperare introdus a expirat.');
    } else {
        if (!$data) {
            FlashMessage::add('Ați introdus o identitate incorectă.');
        } else {
            $user = User::get_by_id($pt->userId);
            if (!$user) {
                FlashMessage::add('Ați introdus un cod de recuperare incorect.');
            } else {
                if ($user->identity) {
                    FlashMessage::add('Acest cont a fost deja revendicat de o identitate OpenID.');
                } else {
                    FlashMessage::add('Contul dumneavoastră a fost recuperat și unificat cu identitatea OpenID.', 'info');
                    session_login($user, $data);
                }
            }
        }
    }
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:recuperare-parola.php

示例15: getRoutingConfig

 private function getRoutingConfig()
 {
     $file = 'route/routing.php';
     if ($this->container->getEnvironment() == "prod") {
         if (\FileCache::isExist($file)) {
             return \FileCache::get($file);
         }
     }
     $sources = \Config::get('routing::source');
     $routings = [];
     foreach ($sources as $source) {
         $routing = (include_once "src/{$source}/routing.php");
         if ($routing) {
             $routings = array_merge($routings, $routing);
         }
     }
     \FileCache::set($file, $routings);
     return $routings;
 }
开发者ID:fucongcong,项目名称:framework,代码行数:19,代码来源:Router.php


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