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


PHP Cache::pull方法代码示例

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


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

示例1: fire

 /**
  * Execute the console command.
  *
  * @return void
  *
  * @throws \Exception
  */
 public function fire()
 {
     $uploadPath = env('UPLOAD_DIR', 'uploads');
     // Use UPLOAD_DIR either as an absolute path, or relative to the base path
     if (!($path = realpath($uploadPath))) {
         $path = base_path($uploadPath);
     }
     $importedSomething = false;
     foreach (scandir($path) as $file) {
         if (in_array($file, ['.', '..', '.gitignore', '.gitkeep'])) {
             continue;
         }
         $version = $this->import($file, $path);
         if ($version) {
             $importedSomething = true;
             $identifier = $version->package->identifier;
             $versionNumber = $version->name;
             $this->info("Imported \"<comment>{$identifier}</comment>\" (@ {$versionNumber})");
             // Make sure the directory exists
             if (!file_exists(dirname($version->storagePath))) {
                 mkdir(dirname($version->storagePath));
             }
             rename($path . '/' . $file, $version->storagePath);
         }
     }
     if ($importedSomething) {
         if (Cache::has('xml.renderedPath')) {
             unlink(Cache::pull('xml.renderedPath'));
         }
     } else {
         $this->info('No files found to import.');
     }
 }
开发者ID:padarom,项目名称:thunderstorm,代码行数:40,代码来源:ImportUploads.php

示例2: test

 /**
  * Test some software's and respond to the user
  *
  * @return \Illuminate\View\View
  * @throws \Exception
  */
 public function test()
 {
     try {
         // Testing Database (MySQL)
         DB::connection()->getDatabaseName();
         // Testing Cache (Redis)
         Cache::pull('test');
         return view('welcome');
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:stevedaddy,项目名称:react,代码行数:18,代码来源:TestingController.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $data['title'] = $request->input('title');
     $data['seo_title'] = $request->input('seo_title');
     $data['destination_id'] = $request->input('destination_id');
     $data['slug'] = str_slug($request->input('slug'));
     $data['description'] = $request->input('description');
     $data['cover_image'] = $request->input('cover_image');
     $data['begin_date'] = $request->input('begin_date');
     $data['end_date'] = $request->input('end_date');
     $data['content'] = $request->input('content');
     $data['score'] = $request->input('score');
     Cache::pull("travel.detail.{$data['slug']}");
     $this->travel->where('id', $id)->update($data);
     //更新游记触达事件
     event(new TravelsWasUpdated($data));
     return redirect()->back();
 }
开发者ID:tanteng,项目名称:tanteng.me,代码行数:25,代码来源:TravelController.php

示例4: pull

 public function pull($key)
 {
     return Cache::pull($key);
 }
开发者ID:xavierauana,项目名称:events,代码行数:4,代码来源:CacheService.php

示例5: pullCache

 public function pullCache()
 {
     Cache::pull($this->getCacheKey());
 }
开发者ID:highideas,项目名称:laravel-users-online,代码行数:4,代码来源:UsersOnlineTrait.php

示例6: runStep

 /**
  * Executes the commands for a step.
  *
  * @param DeployStep $step
  * @throws \RuntimeException
  */
 private function runStep(DeployStep $step)
 {
     foreach ($step->servers as $log) {
         $log->status = ServerLog::RUNNING;
         $log->started_at = date('Y-m-d H:i:s');
         $log->save();
         $server = $log->server;
         $failed = false;
         $cancelled = false;
         try {
             $this->sendFilesForStep($step, $log);
             $process = $this->buildScript($step, $server);
             if (!empty($process)) {
                 $output = '';
                 $process->run(function ($type, $output_line) use(&$output, &$log, $process, $step) {
                     if ($type === \Symfony\Component\Process\Process::ERR) {
                         $output .= $this->logError($output_line);
                     } else {
                         $output .= $this->logSuccess($output_line);
                     }
                     $log->output = $output;
                     $log->save();
                     // If there is a cache key, kill the process but leave the key
                     if ($step->stage <= Stage::DO_ACTIVATE && Cache::has($this->cache_key)) {
                         $process->stop(0, SIGINT);
                         $output .= $this->logError('SIGINT');
                     }
                 });
                 if (!$process->isSuccessful()) {
                     $failed = true;
                 }
                 $log->output = $output;
             }
         } catch (\Exception $e) {
             $log->output .= $this->logError('[' . $server->ip_address . ']: ' . $e->getMessage());
             $failed = true;
         }
         $log->status = $failed ? ServerLog::FAILED : ServerLog::COMPLETED;
         // Check if there is a cache key and if so abort
         if (Cache::pull($this->cache_key) !== null) {
             // Only allow aborting if the release has not yet been activated
             if ($step->stage <= Stage::DO_ACTIVATE) {
                 $log->status = ServerLog::CANCELLED;
                 $cancelled = true;
                 $failed = false;
             }
         }
         $log->finished_at = date('Y-m-d H:i:s');
         $log->save();
         // Throw an exception to prevent any more tasks running
         if ($failed) {
             throw new \RuntimeException('Failed');
         }
         // This is a messy way to do it
         if ($cancelled) {
             throw new \RuntimeException('Cancelled');
         }
     }
 }
开发者ID:JamesForks,项目名称:deployer,代码行数:65,代码来源:DeployProject.php

示例7: destroyClientCacheSP

 public function destroyClientCacheSP($header_id, $detail_id)
 {
     $key = 'clients_' . $header_id;
     if (Cache::has($key)) {
         $clients = Cache::pull($key);
         if (!is_null($clients)) {
             $clients = json_decode($clients, true);
             $client = array_shift($clients);
             if ($client === $detail_id) {
                 $this->setClientCacheSP($header_id, $clients);
             }
             if (count($clients) > 0) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:sibasbo,项目名称:sibas,代码行数:18,代码来源:BaseRepository.php

示例8: getEmailFromToken

 /**
  * Get an email address from supplied token.
  *
  * @param $token
  * @return mixed
  */
 public function getEmailFromToken($token)
 {
     $newEmail = Cache::pull('email_confirmation_' . $token, false);
     if ($newEmail) {
         Cache::forget('email_change_' . $newEmail);
     }
     return $newEmail;
 }
开发者ID:TFidryForks,项目名称:spira,代码行数:14,代码来源:User.php


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