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


PHP Cache::driver方法代码示例

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


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

示例1: getFromCache

 protected function getFromCache($key, $time, $fn)
 {
     $cache = Cache::driver(Cache::getDefaultDriver());
     if ($cache instanceof TaggableStore) {
         $cache->tags('shortener');
     }
     return $cache->remember($key, $time, $fn);
 }
开发者ID:zenapply,项目名称:laravel-shortener,代码行数:8,代码来源:Shortener.php

示例2: getCache

 /**
  * Get the cache object with tags assigned, if applicable.
  *
  * @return \Illuminate\Cache\CacheManager
  */
 protected function getCache()
 {
     $cache = Cache::driver($this->cacheDriver);
     return $this->cacheTags ? $cache->tags($this->cacheTags) : $cache;
 }
开发者ID:nhahv,项目名称:mongodb-rememberable,代码行数:10,代码来源:Builder.php

示例3: register

 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     $app = $this->app;
     $app->bind('App\\Repositories\\User\\UserRepository', function () {
         $user = new EloquentUserRepository(new User());
         $cacheService = Cache::driver();
         $cache = new UserCache($cacheService, $user);
         $validator = App::make('validator');
         return new UserValidator($validator, $cache);
     });
     $app->bind('App\\Repositories\\Post\\PostRepository', function () {
         $post = new EloquentPostRepository(new Post());
         $cacheService = Cache::driver();
         $cache = new PostCache($cacheService, $post);
         $validator = App::make('validator');
         return new PostValidator($validator, $cache);
     });
     $app->bind('App\\Repositories\\News\\NewsRepository', function () {
         $news = new EloquentNewsRepository(new News());
         $cacheService = Cache::driver();
         $cache = new NewsCache($cacheService, $news);
         $validator = App::make('validator');
         return new NewsValidator($validator, $cache);
     });
     $app->bind('App\\Repositories\\Comment\\CommentRepository', function () {
         $comment = new EloquentCommentRepository(new Comment());
         $cacheService = Cache::driver();
         $cache = new CommentCache($cacheService, $comment);
         $validator = App::make('validator');
         return new CommentValidator($validator, $cache);
     });
     $app->bind('App\\Repositories\\QuestionType\\QuestionTypeRepository', function () {
         $questionType = new EloquentQuestionTypeRepository(new QuestionType());
         $cacheService = Cache::driver();
         $cache = new QuestionTypeCache($cacheService, $questionType);
         $validator = App::make('validator');
         return new QuestionTypeValidator($validator, $cache);
     });
     $app->bind('App\\Repositories\\Question\\QuestionRepository', function () {
         $question = new EloquentQuestionRepository(new Question());
         $cacheService = Cache::driver();
         $cache = new QuestionCache($cacheService, $question);
         $validator = App::make('validator');
         return new QuestionValidator($validator, $cache);
     });
     $app->bind('App\\Repositories\\QuestionAnswer\\QuestionAnswerRepository', function () {
         $questionAnswer = new EloquentQuestionAnswerRepository(new Question(), new QuestionAnswer());
         $cacheService = Cache::driver();
         $cache = new QuestionAnswerCache($cacheService, $questionAnswer);
         $validator = App::make('validator');
         return new QuestionAnswerValidator($validator, $cache);
     });
 }
开发者ID:ShuvarthiDhar,项目名称:tobacco,代码行数:58,代码来源:RepositoryServiceProvider.php


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