当前位置: 首页>>代码示例>>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;未经允许,请勿转载。