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


PHP Cache::forget方法代码示例

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


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

示例1: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $load
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, Setting $setting)
 {
     Cache::forget('settings');
     $setting->updateSettings($request, ['site_title', 'site_tags', 'site_description', 'allow_registration', 'pagination_num']);
     flash()->success(trans('all.entry_updated'));
     return redirect(action('Admin\\SettingsController@index'));
 }
开发者ID:Vatia13,项目名称:gbtimes,代码行数:14,代码来源:SettingsController.php

示例2: render

 public function render($format = 'atom', $cache = FALSE, $cacheTime = 3600)
 {
     $channel = $this->channel;
     $channel->pubdate = $this->formatDate($this->channel->pubdate, $format);
     $items = $this->items;
     foreach ($items as $item) {
         $item->pubdate = $this->formatDate($item->pubdate, $format);
     }
     if ($format == 'atom') {
         $this->content_type = 'application/atom+xml';
     } else {
         $this->content_type = 'application/rss+xml';
     }
     if ($cache == TRUE && Cache::has('feed-' . $format)) {
         return response()->view('feed::' . $format, Cache::get('feed-' . $format))->header('Content-Type', $this->content_type)->header('Content-Type', 'text/xml');
     } elseif ($cache == TRUE) {
         Cache::put('feed-' . $format, compact('channel', 'items'), $cacheTime);
         return response()->view('feed::' . $format, compact('channel', 'items'))->header('Content-Type', $this->content_type)->header('Content-Type', 'text/xml');
     } elseif ($cache == FALSE && Cache::has('feed-' . $format)) {
         Cache::forget('feed-' . $format);
         return response()->view('feed::' . $format, compact('channel', 'items'))->header('Content-Type', $this->content_type)->header('Content-Type', 'text/xml');
     } else {
         return response()->view('feed::' . $format, compact('channel', 'items'))->header('Content-Type', $this->content_type)->header('Content-Type', 'text/xml');
     }
 }
开发者ID:zogxray,项目名称:simple-laravel-feed,代码行数:25,代码来源:Feed.php

示例3: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if ($this->option('tracks') === 'all') {
         // Get all cacheable track files
         $trackFiles = TrackFile::where('is_cacheable', true)->with('track.album')->get();
     } else {
         // Get all expired track files
         $trackFiles = TrackFile::where('is_cacheable', true)->where('expires_at', '<=', Carbon::now())->with('track.album')->get();
     }
     // Delete above track files
     if (count($trackFiles) === 0) {
         $this->info('No tracks found. Exiting.');
     } else {
         if ($this->option('force') || $this->confirm(count($trackFiles) . ' cacheable track files found. Proceed to delete their files if they exist? [y|N]', false)) {
             $count = 0;
             foreach ($trackFiles as $trackFile) {
                 // Set expiration to null (so can be re-cached upon request)
                 $trackFile->expires_at = null;
                 $trackFile->update();
                 // Delete file if exists
                 if (File::exists($trackFile->getFile())) {
                     $count++;
                     File::delete($trackFile->getFile());
                     $this->info('Deleted ' . $trackFile->getFile());
                 }
                 // Remove the cached file size for the album
                 Cache::forget($trackFile->track->album->getCacheKey('filesize-' . $trackFile->format));
             }
             $this->info($count . ' files deleted. Deletion complete. Exiting.');
         } else {
             $this->info('Deletion cancelled. Exiting.');
         }
     }
 }
开发者ID:nsystem1,项目名称:Pony.fm,代码行数:39,代码来源:ClearTrackCache.php

示例4: unlink

 public function unlink()
 {
     if (Cache::has($this->name)) {
         return Cache::forget($this->name);
     }
     return FALSE;
 }
开发者ID:craigmccoy,项目名称:rss-laravel,代码行数:7,代码来源:RssCache.php

示例5: boot

 public static function boot()
 {
     parent::boot();
     Webhook::creating(function ($results) {
         Cache::forget('webhooks');
     });
 }
开发者ID:alfred-nutile-inc,项目名称:webhooks,代码行数:7,代码来源:Webhook.php

示例6: updateApproveStatus

 protected function updateApproveStatus()
 {
     Cache::forget($this->qdn->slug);
     $status['status'] = $this->status() ? 'Q.a. Verification' : 'Incomplete Approval';
     $this->qdn->closure()->update($status);
     return $this;
 }
开发者ID:rob1121,项目名称:qdn,代码行数:7,代码来源:DbApproverTransaction.php

示例7: handle

 /**
  * @inheritdoc
  */
 public function handle($arguments)
 {
     if (!Cache::has('site-' . $arguments)) {
         $this->replyWithMessage("Não foi encontrado nenhum site com esse argumento.");
         return;
     }
     $site = Cache::get('site-' . $arguments);
     // Validate if the URL isn't on the database yet
     if (Site::where('url', '=', $site)->first() != null) {
         $this->replyWithMessage("O site {$site} já se encontra na base de dados.");
         return;
     }
     $site_obj = new Site();
     $site_obj->url = $site;
     $site_obj->save();
     $this->replyWithMessage($site . " foi adicionado à base de dados.", true);
     // Notify the sitesbloqueados.pt about the new site
     $url = 'https://sitesbloqueados.pt/wp-json/ahoy/refresh';
     $cmd = "curl -X GET -H 'Content-Type: application/json'";
     $cmd .= " " . "'" . $url . "'";
     $cmd .= " > /dev/null 2>&1 &";
     exec($cmd, $output);
     // Flush the PAC cache
     Cache::tags(['generate_pac'])->flush();
     // Remove the cache
     Cache::forget('site-' . $arguments);
     Cache::forget('site-list');
 }
开发者ID:revolucaodosbytes,项目名称:ahoy-api,代码行数:31,代码来源:AddNewSiteCommand.php

示例8: check

 /**
  * Check if the api key is passed its limit, while also adding or updating cache
  * 
  * @param ApiKey $apiKey - The api key in question
  * @return boolean - Is the api key being rate limited
  */
 public static function check(\ApiKey $apiKey)
 {
     $public_key = $apiKey->public_key;
     $accessLevel = $apiKey->accessLevel;
     // check cache for the key, create is doesn't exist
     if (!Cache::has($public_key)) {
         self::generateCache($public_key, $accessLevel);
     }
     // get the cache
     $cache = json_decode(Cache::get($public_key));
     // create timestamp instances for when the cache was created and now
     $cachedTimestamp = Carbon::createFromFormat('Y-m-d H:i:s', $cache->expires_at);
     $timestamp = Carbon::now();
     // check if cache has expired, if so create cache
     if ($timestamp->gt($cachedTimestamp)) {
         Cache::forget($public_key);
         self::generateCache($public_key, $accessLevel);
         $cache = json_decode(Cache::get($public_key));
     }
     // check if api key is over request limit
     if ($cache->remaining <= 0) {
         return false;
     }
     // decrement remaining requests by 1
     $cache->remaining -= 1;
     // update cache
     Cache::put($apiKey->public_key, json_encode($cache), 0);
     return true;
 }
开发者ID:ryanmcoble,项目名称:remedy,代码行数:35,代码来源:RateLimiter.php

示例9: onKeysFlush

 public function onKeysFlush()
 {
     $keys = $this->controller->getDefinitionOption('cache.keys', array());
     foreach ($keys as $key) {
         Cache::forget($key);
     }
 }
开发者ID:OlesKashchenko,项目名称:Jarboe,代码行数:7,代码来源:CacheHandler.php

示例10: boot

 public static function boot()
 {
     parent::boot();
     static::saved(function () {
         Cache::forget(static::HOME_CACHE_KEY);
         return true;
     });
 }
开发者ID:michaeljoyner,项目名称:expeditionists,代码行数:8,代码来源:ClearsHomeCache.php

示例11: logout

 public function logout()
 {
     Cache::forget('role_id');
     Cache::forget('this_user');
     Logs::add('process', 'Kullanıcı Çıkış Yaptı');
     Auth::logout();
     return redirect()->route('master_page');
 }
开发者ID:ringwoodinternet,项目名称:core,代码行数:8,代码来源:AuthController.php

示例12: getThemeColorChange

 /**
  * Admin Theme Color Change
  *
  * @param   Request         $request
  * @return  \Illuminate\Http\Response
  */
 public function getThemeColorChange(Request $request)
 {
     if (Cache::has('theme_color')) {
         Cache::forget('theme_color');
     }
     Cache::forever('theme_color', $request->all());
     return response()->json(['result' => true]);
 }
开发者ID:erenmustafaozdal,项目名称:laravel-modules-core,代码行数:14,代码来源:ThemeController.php

示例13: logout

 public function logout()
 {
     Cache::forget('role_id');
     Cache::forget('this_user');
     Logs::add('process', trans('whole::http/controllers.auth_log_3'));
     Auth::logout();
     return redirect()->route('master_page');
 }
开发者ID:phpspider,项目名称:core,代码行数:8,代码来源:AuthController.php

示例14: bootPermissionTrait

 /**
  * bootPermissionTrait.
  *
  * @method bootPermissionTrait
  */
 public static function bootPermissionTrait()
 {
     static::saved(function ($model) {
         Cache::forget(static::cacheKey());
     }, 99);
     static::deleted(function () {
         Cache::forget(static::cacheKey());
     }, 99);
 }
开发者ID:recca0120,项目名称:laravel-rbac,代码行数:14,代码来源:PermissionTrait.php

示例15: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @param Request $request
  * @return Response
  */
 public function update($id, Request $request)
 {
     $this->authorize('authorizeAccess', 'category_edit');
     $this->fieldCategory->where('id', '=', $id)->update(['name_ar' => $request->input('name_ar'), 'name_en' => $request->input('name_en')]);
     $fieldsCategories = $this->fieldCategory->all();
     Cache::forget('fieldsCategories');
     Cache::forever('fieldsCategories', $fieldsCategories);
     return redirect()->back()->with('success', trans('messages.success.updated'));
 }
开发者ID:uusa35,项目名称:ebook,代码行数:16,代码来源:FieldCategoriesController.php


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