當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cache::tags方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Cache::tags方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::tags方法的具體用法?PHP Cache::tags怎麽用?PHP Cache::tags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\Cache的用法示例。


在下文中一共展示了Cache::tags方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: restore

 public function restore()
 {
     //soft delete undo's
     $result = parent::restore();
     Cache::tags(Config::get('entrust.permission_role_table'))->flush();
     return $result;
 }
開發者ID:eyaylagul,項目名稱:entrust,代碼行數:7,代碼來源:EntrustRoleTrait.php

示例3: onTagsFlush

 public function onTagsFlush()
 {
     $tags = $this->controller->getDefinitionOption('cache.tags', array());
     foreach ($tags as $tag) {
         Cache::tags($tag)->flush();
     }
 }
開發者ID:OlesKashchenko,項目名稱:Jarboe,代碼行數:7,代碼來源:CacheHandler.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (app()->environment() == 'local') {
         Cache::tags('views')->flush();
     }
     return $next($request);
 }
開發者ID:steveazz,項目名稱:rudolly,代碼行數:14,代碼來源:FlushView.php

示例5: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Feedback::created(function ($item) {
         Cache::tags('feedbacks')->flush();
         $this->dispatch(new SentenceProcessing($item));
     });
     Feedback::updated(function ($item) {
         Cache::tags('feedbacks')->flush();
     });
     Feedback::deleted(function ($item) {
         Cache::tags('feedbacks')->flush();
     });
     Comment::saved(function ($item) {
         Cache::tags('comments')->flush();
     });
     Comment::saved(function ($item) {
         Cache::tags('comments')->flush();
     });
     Sentence::saved(function ($item) {
         if ($item->feedback) {
             $item->feedback->calculateProbabilities();
         }
     });
 }
開發者ID:uethackathon,項目名稱:uethackathon2015_team13,代碼行數:31,代碼來源:EventServiceProvider.php

示例6: putAll

 /**
  * Handle permissions change
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function putAll(Request $request)
 {
     $permissions = Permission::all();
     $input = array_keys($request->input('permissions'));
     try {
         DB::beginTransaction();
         $permissions->each(function ($permission) use($input) {
             if (in_array($permission->id, $input)) {
                 $permission->allow = true;
             } else {
                 $permission->allow = false;
             }
             $permission->save();
         });
         DB::commit();
         flash()->success(trans('permissions.save_success'));
     } catch (\Exception $e) {
         var_dump($e->getMessage());
         die;
         flash()->error(trans('permissions.save_error'));
     }
     try {
         Cache::tags(['permissions'])->flush();
     } catch (\Exception $e) {
         Cache::flush();
     }
     return redirect()->back();
 }
開發者ID:Denniskevin,項目名稱:Laravel5Starter,代碼行數:34,代碼來源:AdminPermissionsController.php

示例7: restore

 public function restore()
 {
     //soft delete undo's
     parent::restore();
     Cache::tags('permission_section_users')->flush();
     Cache::tags('role_user')->flush();
 }
開發者ID:aldozumaran,項目名稱:acl,代碼行數:7,代碼來源:AclUserTrait.php

示例8: getCacheInstance

 /**
  * Gets the cache engine instance. This method is used when the cache is referenced
  * with tags. In some cases like if the active cache driver is file, then the tags
  * method does not work and throws exception.
  *
  * @param array $cacheTags
  * @return mixed
  */
 protected static function getCacheInstance(array $cacheTags)
 {
     try {
         return Cache::tags($cacheTags);
     } catch (\ErrorException $e) {
         return Cache::getFacadeRoot();
     }
 }
開發者ID:Denniskevin,項目名稱:Laravel5Starter,代碼行數:16,代碼來源:CacheTrait.php

示例9: remember

 public static function remember($key, $callback)
 {
     if (!Cache::has($key)) {
         $value = $callback();
         Cache::tags(self::TAG)->put($key, $value, 60);
     }
     return Cache::tags(self::TAG)->get($key);
 }
開發者ID:kcwikizh,項目名稱:kcwiki-api,代碼行數:8,代碼來源:SubtitleCache.php

示例10: getSystemConfig

 public function getSystemConfig($field)
 {
     if (empty($value = Cache::tags(self::REDIS_SYSTEM_CONFIG)->get(self::REDIS_SYSTEM_CONFIG . $field))) {
         $value = self::select('system_value')->where('system_key', $field)->pluck('system_value');
         Cache::tags(self::REDIS_SYSTEM_CONFIG)->put(self::REDIS_SYSTEM_CONFIG . $field, $value, config('site')['redis_cache_time']);
     }
     return $value;
 }
開發者ID:xinzou,項目名稱:blog,代碼行數:8,代碼來源:Systems.php

示例11: restore

 public function restore()
 {
     //soft delete undo's
     parent::restore();
     if (Cache::getStore() instanceof TaggableStore) {
         Cache::tags(Config::get('entrust.role_user_table'))->flush();
     }
 }
開發者ID:yaoshanliang,項目名稱:entrust,代碼行數:8,代碼來源:EntrustUserTrait.php

示例12: findMany

 /**
  * Find a model by its primary key.
  *
  * @param array $ids
  * @param array $columns
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function findMany($ids, $columns = ['*'])
 {
     if (empty($ids)) {
         return $this->model->newCollection();
     }
     return $this->model->newCollection(Cache::tags($this->model->getTable())->rememberMany($ids, $this->model->cacheExpiry, function ($ids) use($columns) {
         return parent::findMany($ids, $columns)->all();
     }));
 }
開發者ID:tshafer,項目名稱:laravel-traits,代碼行數:17,代碼來源:Builder.php

示例13: restore

 public function restore()
 {
     //soft delete undo's
     if (!parent::restore()) {
         return false;
     }
     Cache::tags(Config::get('entrust.permission_role_table'))->flush();
     return true;
 }
開發者ID:SocietyCMS,項目名稱:User,代碼行數:9,代碼來源:EntrustRoleTrait.php

示例14: setCache

 protected function setCache($shareCount)
 {
     $minutes = config('yaro.soc-share.cache_minutes');
     if (!$minutes) {
         return null;
     }
     $key = $this->provider . '.' . md5(serialize($this->options));
     return Cache::tags('soc-share')->put($key, $shareCount, $minutes);
 }
開發者ID:applevladko,項目名稱:SocShare,代碼行數:9,代碼來源:AbstractProvider.php

示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $feedbacks = Cache::tags(['feedbacks', 'index', 'comments'])->get('feedbacks.index');
     if (!$feedbacks) {
         $feedbacks = Feedback::with('status', 'visibility', 'comments')->get()->sortBy('created_at');
         Cache::tags(['feedbacks', 'index', 'comments'])->put('feedbacks.index', $feedbacks, 1);
     }
     return view('backend.feedbacks.index', ['feedbacks' => $feedbacks]);
 }
開發者ID:uethackathon,項目名稱:uethackathon2015_team13,代碼行數:14,代碼來源:FeedbackController.php


注:本文中的Illuminate\Support\Facades\Cache::tags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。