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