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


PHP Cache::forever方法代碼示例

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


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

示例1: handle

 /**
  * @throws \Exception
  */
 public function handle()
 {
     $name = $this->argument('name');
     $isUserRestrict = $this->confirm('User restricted ?', false);
     $author = $this->ask("Your username", Cache::get('developer.username', ''));
     Cache::forever('developer.username', $author);
     $generator = new Generator($name, $isUserRestrict, $author);
     $templateData = $generator->getTemplateData();
     $files = $generator->getFiles();
     $belongToRelations = $this->getRelation('BelongTo');
     if ($isUserRestrict) {
         $belongToRelations[] = 'user';
     }
     $belongToRelations = array_unique($belongToRelations);
     $manyToManyRelations = $this->getRelation('ManyToMany');
     $manyToManyRelations = array_unique($manyToManyRelations);
     $fields = $this->getFields();
     $this->summary($templateData, $isUserRestrict);
     $this->fieldsSummary($fields);
     $this->generate($generator, $fields, ['belongTo' => $belongToRelations, 'manyToMany' => $manyToManyRelations]);
     $this->runComposerDumpAutoload();
     $this->migrateDatabase();
     $this->generateDocumentation();
     $this->info("");
     $this->info("What you need to do now ?");
     $this->info("\t [] Add Acl/Scope to your route in routes.php");
     $this->info("\t [] Fill data provider for " . $files['controllerTest']);
     $this->info("\t [] Fill data provider for " . $files['repositoryTest']);
 }
開發者ID:ndrx-io,項目名稱:elude,代碼行數:32,代碼來源:ApiGenerator.php

示例2: array

 /**
  * Setup for Google API authorization to retrieve directory data
  */
 function __construct()
 {
     // set config options
     $clientId = Config::get('google.client_id');
     $serviceAccountName = Config::get('google.service_account_name');
     $delegatedAdmin = Config::get('google.admin_email');
     $keyFile = base_path() . Config::get('google.key_file_location');
     $appName = Config::get('google.app_name');
     // array of scopes
     $scopes = array('https://www.googleapis.com/auth/admin.directory.user', 'https://www.googleapis.com/auth/admin.directory.user.readonly');
     // Create AssertionCredentails object for use with Google_Client
     $creds = new \Google_Auth_AssertionCredentials($serviceAccountName, $scopes, file_get_contents($keyFile));
     // set admin identity for API requests
     $creds->sub = $delegatedAdmin;
     // Create Google_Client to allow making API calls
     $this->client = new \Google_Client();
     $this->client->setApplicationName($appName);
     $this->client->setClientId($clientId);
     $this->client->setAssertionCredentials($creds);
     if ($this->client->getAuth()->isAccessTokenExpired()) {
         $this->client->getAuth()->refreshTokenWithAssertion($creds);
     }
     Cache::forever('service_token', $this->client->getAccessToken());
     // Set instance of Directory object for making Directory API related calls
     $this->service = new \Google_Service_Directory($this->client);
 }
開發者ID:staciewilhelm,項目名稱:denver-member-tracking,代碼行數:29,代碼來源:GoogleDirectory.php

示例3: getTimestampMigrationName

 /**
  * @return string
  */
 protected function getTimestampMigrationName()
 {
     if (!Cache::has(static::CACHENAME)) {
         Cache::forever(static::CACHENAME, date('Y_m_d_His') . '_' . $this->getMigrationName());
     }
     return Cache::get(static::CACHENAME);
 }
開發者ID:jayaregalinada,項目名稱:common,代碼行數:10,代碼來源:OptionServiceProvider.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::user()) {
         Cache::forever('last_seen_' . Auth::user()->id, date('Y-m-d H:i:s'));
     }
     return $next($request);
 }
開發者ID:Denniskevin,項目名稱:Laravel5Starter,代碼行數:14,代碼來源:LastActivity.php

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

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Cache::has('settings')) {
         $settings = json_decode(Storage::get('settings.json'), true);
         Cache::forever('settings', $settings);
     }
     return $next($request);
 }
開發者ID:ambarsetyawan,項目名稱:brewski,代碼行數:15,代碼來源:SettingsCacheMiddleware.php

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

示例8: cacheSetting

 public function cacheSetting()
 {
     $setting = self::all();
     $set = [];
     foreach ($setting as $k => $v) {
         $set[$v['key']] = $v['value'];
     }
     Cache::forever('setting', $set);
 }
開發者ID:sdlyhu,項目名稱:laravel5-angular-backend,代碼行數:9,代碼來源:Setting.php

示例9: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $position = Cache::get(self::class, 0);
     if (!isset($this->shouts[$position])) {
         return;
     }
     Shout::create(['message' => $this->shouts[$position]]);
     Cache::forever(self::class, ++$position);
 }
開發者ID:valorin,項目名稱:phpnz15-shoutbox,代碼行數:14,代碼來源:ShoutCommand.php

示例10: fillCacheTrans

 public static function fillCacheTrans()
 {
     if (Cache::get('translations')) {
         $array_translate = Cache::get('translations');
     } else {
         $array_translate = self::getArrayTranslation();
         Cache::forever('translations', $array_translate);
     }
     return $array_translate;
 }
開發者ID:arturishe21,項目名稱:translations,代碼行數:10,代碼來源:Trans.php

示例11: groupOfName

 /**
  * @param $name
  * @return Group
  */
 public function groupOfName($name)
 {
     $cache_key = md5('group.' . $name);
     if (Cache::has($cache_key)) {
         return Cache::get($cache_key);
     }
     $group = $this->em->getRepository($this->groupClass)->findOneBy(['lastName' => $name]);
     Cache::forever($cache_key, $group);
     return $group;
 }
開發者ID:bakgat,項目名稱:notos,代碼行數:14,代碼來源:GroupDoctrineORMRepository.php

示例12: updateSideBarCache

 public static function updateSideBarCache()
 {
     $categories = Category::all();
     $posts = Post::orderBy('updated_at', 'desc')->limit(2)->get();
     if (Cache::has('categories') || Cache::has('posts')) {
         Cache::flush();
     }
     Cache::forever('posts', compact('posts'));
     Cache::forever('categories', compact('categories'));
 }
開發者ID:shempignon,項目名稱:laravel-5-blog-mvc,代碼行數:10,代碼來源:PostServiceProvider.php

示例13: getSort

 public static function getSort()
 {
     if (Cache::has(GlobalVar::$SORT_CACHE)) {
         return Cache::get(GlobalVar::$SORT_CACHE);
     } else {
         $sorts = Sort::all();
         Cache::forever(GlobalVar::$SORT_CACHE, $sorts);
         return $sorts;
     }
 }
開發者ID:bajian,項目名稱:BiliPusher,代碼行數:10,代碼來源:CacheSetter.php

示例14: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request)
 {
     $setting = $this->settingRepository->first();
     $status = $this->settingRepository->update($request->all(), $setting->id);
     if ($status) {
         Cache::forever('systemSetting', (object) $request->except('_token'));
         return redirect()->route('dashboard.system.setting')->with('message', trans('validation.notice.update_system_success'));
     }
     return back()->with('fail', trans('validation.notice.database_error'));
 }
開發者ID:axex,項目名稱:kratos,代碼行數:17,代碼來源:AdminSystemSettingController.php

示例15: writeStatus

 /**
  * Store status in cache or print.
  *
  * @param string $status
  * @param bool $webExecution
  */
 protected function writeStatus($status, $webExecution)
 {
     if ($webExecution) {
         $cachedStatus = unserialize(Cache::get('scaffolder-status'));
         array_push($cachedStatus, $status);
         Cache::forever('scaffolder-status', serialize($cachedStatus));
     } else {
         $this->info($status);
     }
 }
開發者ID:mpaleo,項目名稱:scaffolder,代碼行數:16,代碼來源:BaseCommand.php


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