當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。