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


PHP Cache::pull方法代码示例

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


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

示例1: setupDb

 /**
  * Sets up db by running migration and seeder.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function setupDb()
 {
     if (\Cache::get('setup_db', false)) {
         $request = \Request::instance();
         $method = $request->method();
         if (Verbs::GET === $method) {
             return view('setup', ['version' => config('df.version')]);
         } else {
             if (Verbs::POST === $method) {
                 try {
                     if (\Cache::pull('setup_db', false)) {
                         \Artisan::call('migrate', ['--force' => true]);
                         \Artisan::call('db:seed', ['--force' => true]);
                         if ($request->ajax()) {
                             return json_encode(['success' => true, 'redirect_path' => '/setup']);
                         } else {
                             return redirect()->to('/setup');
                         }
                     } else {
                         if ($request->ajax()) {
                             return json_encode(['success' => false, 'message' => 'Setup not required. System is already setup']);
                         }
                     }
                 } catch (\Exception $e) {
                     if ($request->ajax()) {
                         return json_encode(['success' => false, 'message' => $e->getMessage()]);
                     } else {
                         return view('errors.generic', ['error' => $e->getMessage(), 'version' => config('df.version')]);
                     }
                 }
             }
         }
     }
     return redirect()->to('/');
 }
开发者ID:abhijitroy07,项目名称:dreamfactory,代码行数:40,代码来源:SplashController.php

示例2: hasInvalidState

 /**
  * {@inheritdoc}
  */
 protected function hasInvalidState()
 {
     if ($this->isStateless()) {
         return false;
     }
     $urlState = $this->request->input('state');
     $cacheState = \Cache::pull($urlState);
     return !(strlen($cacheState) > 0 && $urlState === $cacheState);
 }
开发者ID:pkdevboxy,项目名称:df-oauth,代码行数:12,代码来源:DfOAuthTwoProvider.php

示例3: getToken

 /**
  * Get the token credentials for the request.
  *
  * @return \League\OAuth1\Client\Credentials\TokenCredentials
  */
 protected function getToken()
 {
     $temp = null;
     if ($this->usesState()) {
         $temp = $this->request->getSession()->get('oauth.temp');
     } else {
         $key = $this->request->get('oauth_token');
         $temp = \Cache::pull($key);
     }
     return $this->server->getTokenCredentials($temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier'));
 }
开发者ID:df-arif,项目名称:df-oauth,代码行数:16,代码来源:DfOAuthOneProvider.php

示例4: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     echo 'Iniciado' . PHP_EOL;
     $start = microtime(true);
     $cacheKey = md5(uniqid(''));
     $totalUsers = User::count();
     $pid = pcntl_fork();
     if ($pid == -1) {
         die('could not fork =(');
     } else {
         if ($pid) {
             // we are the parent
             //É necessário reconectar no banco, os processos vão compartilhar
             //a conexão, o que irá gerar erro
             \DB::reconnect('mysql');
             //Pega os usuários da primeira metade do total
             $users = $this->getUsers($totalUsers / 2, 0);
             //Aguarda o processo filho terminar
             pcntl_wait($status);
             //Faz um merge do que o processo pai e filho processaram
             //Os dados do processo filho estão no cache
             $users = array_merge($users, \Cache::pull($cacheKey));
         } else {
             // we are the child
             //É necessário reconectar no banco, os processos vão compartilhar
             //a conexão, o que irá gerar erro
             \DB::reconnect('mysql');
             //Pega os usuários da segunda metade do total
             $users = $this->getUsers($totalUsers / 2, $totalUsers / 2);
             //Armazena os usuários processados no cache
             \Cache::forever($cacheKey, $users);
             die;
         }
     }
     echo 'Processados ' . count($users) . ' usuários' . PHP_EOL;
     echo 'Demorou ' . number_format((microtime(true) - $start) * 1000, 2, ',', '') . 'ms' . PHP_EOL;
 }
开发者ID:beingsane,项目名称:SeminarioLocaweb,代码行数:42,代码来源:BuildForkCommand.php

示例5: removeCache

 /**
  * 清除缓存
  * @param string $cachename
  * @return boolean
  */
 public static function removeCache($cachename)
 {
     //TODO: remove cache implementation
     return \Cache::pull($cachename);
 }
开发者ID:formatcc,项目名称:laravel-wechat,代码行数:10,代码来源:Cache.php

示例6: getToken

 /**
  * {@inheritdoc}
  */
 protected function getToken()
 {
     $key = $this->request->get('oauth_token');
     $temp = \Cache::pull($key);
     return $this->server->getTokenCredentials($temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier'));
 }
开发者ID:pkdevboxy,项目名称:df-oauth,代码行数:9,代码来源:DfOAuthOneProvider.php

示例7: testMakeLoginToken

 public function testMakeLoginToken()
 {
     $user = $this->createUser();
     $token = $user->makeLoginToken($user->user_id);
     $id = Cache::pull('login_token_' . $token);
     $this->assertEquals($id, $user->user_id);
 }
开发者ID:TFidryForks,项目名称:spira,代码行数:7,代码来源:AuthTest.php

示例8:

                <a href="http://github.com/atrauzzi/laravel-drydock">Github</a>

                @if($lastCronRun)
                    <div class="notice">Last cron run {{ $lastCronRun }} (runs every minute)</div>
                @endif

                <hr />

                <input type="email" id="email" placeholder="Enter an email address..." />
                <input type="text" id="message" placeholder="Enter a message..." />
                <a href="javascript:void(0)" onclick="location.href='/dev/queue/test?message=' + message.value + '&email=' + email.value; message.value=''; email.value='';">Queue it!</a>

                <br />

                <?php 
$message = Cache::pull('last-message');
?>
                <div id="last-message">
                    @if($message)
                    <div>
                        <h4>Your message is done processing!</h4>
                        <div class="notice">{{ $message }}</div>
                    </div>
                    @endif
                </div>

            </div>
        </div>
    </body>
</html>
开发者ID:atrauzzi,项目名称:laravel-drydock,代码行数:30,代码来源:welcome.blade.php

示例9: function

Route::post('activate/FirstLink', ['as' => '1stlinkactivation', 'uses' => 'CodeController@activateFirstLink']);
// after first link is activated dont show anymore this url to them
Route::post('signup', ['as' => 'signup', 'uses' => 'Auth\\AuthController@create']);
// Route::get('{link?}', ['as' => 'links', 'uses' => 'LinkController@getRefLink']);
Route::get('activeSponsor/{id}', function ($id) {
    $id = App\Link::where('id', $id)->firstOrFail()->activeSponsor($id);
    return $id;
});
// Route::get('code/all', ['as' => 'codeall', 'uses' => 'CodeController@index']);
Route::get('code/{linkID}/{PINCODE}', ['as' => 'code', 'uses' => 'CodeController@attachLink']);
// Update user account data
// Route::put('profile', ['as' => 'profile/update', 'uses' => 'UserController@update']); // Not working yet
Route::get('/vue', function () {
    return view('vue');
});
Route::get('api/users', function () {
    $value = Cache::rememberForever('users', function () {
        return \App\Profile::latest()->take(50)->select('display_name', 'created_at')->get();
        // Should Only Fetch the Users Display Name!
    });
    return $value = Cache::pull('users');
});
//Route::post('api/users', function(){
//	 App\User::create(Request::all());
//});
//
Route::get('getCookie', function () {
    return view('welcome');
});
//Route::get('/activate/{code}', 'Auth\AuthController@activateAccount
Route::get('{link?}', ['as' => 'reflink', 'uses' => 'LinkController@showRefLink']);
开发者ID:xenxa,项目名称:royalflushnetwork,代码行数:31,代码来源:routes.php

示例10: getActivation

 /**
  * Actiovation account
  */
 public function getActivation($code = null)
 {
     if (Session::get('activated')) {
         return View::make(Config::get('larauth::views.activation'));
     }
     if (Input::get('code')) {
         $code = Input::get('code');
     }
     if ($code) {
         try {
             $user = Sentry::findUserByActivationCode($code);
             $user->attemptActivation($code);
             // добавляем пользователя в группы
             foreach (Config::get('larauth::append_groups') as $group) {
                 try {
                     $oGroup = Sentry::findGroupByName($group);
                 } catch (\Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
                     Log::alert("Попытка добавдения пользователя :user_email в несуществующую группу :group", ['user_email' => $user->email, 'group' => $group]);
                 }
                 $user->addGroup($oGroup);
             }
             $data = ['email' => $user->email, 'password' => Cache::pull(md5($user->email)), 'subject' => trans('larauth::larauth.registration_success')];
             $this->sendMail(Config::get('larauth::views.mail_registration'), $data);
             return Redirect::route('larauth.activation')->with('activated', TRUE);
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             return Redirect::route('larauth.activation')->with('error', trans('larauth::larauth.wrong_activation_code'));
         }
     }
     return View::make(Config::get('larauth::views.activation'), ['error' => Session::get('error'), 'code' => $code]);
 }
开发者ID:bitw,项目名称:larauth,代码行数:33,代码来源:LarauthController.php

示例11: function

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
$route->group(['middleware' => ['web']], function (Router $route) {
    $route->get('/', function () {
        $lastCronRun = new \Carbon\Carbon(Cache::get('last-cron'));
        $lastCronRun = $lastCronRun->diffForHumans();
        return view('welcome', compact('lastCronRun'));
    });
    $route->get('/dev/info', function () {
        ob_start();
        phpinfo();
        $phpinfo = ob_get_contents();
        ob_end_clean();
        return new Response($phpinfo);
    });
    $route->get('/dev/queue/test', function (Request $request) {
        dispatch(new TestJob($request->get('message'), $request->get('email')));
        return new Response(null, 204);
    });
    $route->get('/api/web/last-message', function (Request $request) {
        return new JsonResponse(Cache::pull('last-message'));
    });
});
开发者ID:atrauzzi,项目名称:laravel-drydock,代码行数:31,代码来源:routes.php

示例12: function

/*
*	Main page
*/
Route::filter('dashboardFilter', function () {
    if (!Schema::hasTable('users')) {
        return Redirect::to('start');
    }
    if (!User::all()->count()) {
        return Redirect::to('register');
    }
    if (!Auth::check()) {
        return Redirect::to('login');
    }
});
Route::get('/', array('before' => array('dashboardFilter', 'nexmo'), function () {
    return View::make('hello', array('credit_balance' => Cache::pull('nexmo'), 'numbers' => Number::all()));
}));
/*
*	Login page
*/
Route::filter('loginFilter', function () {
    if (!Schema::hasTable('users')) {
        return Redirect::to('start');
    }
    if (!User::all()->count()) {
        return Redirect::to('register');
    }
});
Route::get('/login', array('before' => array('loginFilter', 'nexmo'), 'as' => 'login', function () {
    return View::make('login');
}));
开发者ID:aa6my,项目名称:nexmo-dashboard,代码行数:31,代码来源:routes.php


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