• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Cache\CacheManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Illuminate\Cache\CacheManager的典型用法代码示例。如果您正苦于以下问题:PHP CacheManager类的具体用法?PHP CacheManager怎么用?PHP CacheManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: handle

 /**
  * Handle the command.
  *
  * @param CacheManager       $cache
  * @param FieldMigrator      $fields
  * @param StreamMigrator     $streams
  * @param AssignmentMigrator $assignments
  */
 public function handle(CacheManager $cache, FieldMigrator $fields, StreamMigrator $streams, AssignmentMigrator $assignments)
 {
     $assignments->reset($this->migration);
     $fields->reset($this->migration);
     $streams->reset($this->migration);
     $cache->flush();
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:15,代码来源:Reset.php


示例2: addFileCacheDriver

 protected function addFileCacheDriver(CacheManager $cacheManager)
 {
     $cacheManager->extend(static::$fileDriverName, function ($app, array $cacheConfig) use($cacheManager) {
         $store = new AlternativeHierarchialFileCacheStore(new Filesystem(static::makeFileCacheAdapter($cacheConfig)), static::getPrefix($cacheConfig));
         return $cacheManager->repository($store);
     });
 }
开发者ID:swayok,项目名称:alternative-laravel-cache,代码行数:7,代码来源:AlternativeCacheStoresServiceProvider.php


示例3: boot

 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot(CacheManager $cacheManager)
 {
     $cacheManager->extend('dummy', function ($app) {
         $prefix = $app['config']->get('cache.prefix');
         return $app['cache']->repository(new DummyCacheStore($prefix));
     });
 }
开发者ID:assurrussa,项目名称:dummy-cache,代码行数:12,代码来源:DummyCacheServiceProvider.php


示例4: cache

 /**
  * Return the cache instance with tags attached
  *
  * @return \Illuminate\Cache\CacheManager
  */
 protected function cache()
 {
     if (!method_exists($this->cache, 'tags')) {
         return $this->cache;
     }
     return $this->cache->tags($this->tag);
 }
开发者ID:pavankumarkatakam,项目名称:jwt-auth,代码行数:12,代码来源:IlluminateCacheAdapter.php


示例5: finish

 /**
  * Finish installation.
  *
  * @param Dispatcher   $events
  * @param CacheManager $cache
  * @return \Illuminate\View\View
  */
 public function finish(Dispatcher $events, CacheManager $cache)
 {
     $cache->store()->flush();
     $action = 'finish';
     $installers = $this->dispatch(new GetSeeders());
     $events->fire(new StreamsHasInstalled($installers));
     return view('anomaly.module.installer::process', compact('action', 'installers'));
 }
开发者ID:AkibaTech,项目名称:installer-module,代码行数:15,代码来源:InstallerController.php


示例6: getStore

 public static function getStore()
 {
     if (!static::$store) {
         $manager = new CacheManager(new ConfigContainer(array('db' => \DLModel::getConnectionResolver(), 'encrypter' => Encrypter::getInstance(), 'config' => array('cache.driver' => 'database', 'cache.prefix' => 'schema_', 'cache.stores.database' => array('driver' => 'database', 'connection' => 'default', 'table' => 'cache')))));
         static::$store = $manager->driver('database')->getStore();
     }
     return static::$store;
 }
开发者ID:CFLOVEYR,项目名称:hook,代码行数:8,代码来源:Cache.php


示例7: make

 public static function make()
 {
     if (is_null(self::$instance)) {
         $cacheManager = new CacheManager(array('files' => new FileSystem(), 'config' => array('cache.driver' => 'file', 'cache.path' => path('cache'), 'cache.prefix' => 'wordpress_')));
         $cache = $cacheManager->driver();
         self::$instance = new static($cache);
     }
     return self::$instance;
 }
开发者ID:bruno-barros,项目名称:wordpress-packages,代码行数:9,代码来源:Cache.php


示例8: showDashboard

 /**
  * Return the admin dashboard view.
  *
  * @return \Illuminate\View\View
  */
 public function showDashboard(CacheManager $cache)
 {
     $stats = ['Item stats' => ['Listed' => function ($range) use($cache) {
         return mustard_number($cache->remember('total_items', config('mustard.dashboard_cache'), function () use($range) {
             return Item::totalListed($range);
         }));
     }, 'Watched' => function ($range) use($cache) {
         return mustard_number($cache->remember('total_items', config('mustard.dashboard_cache'), function () use($range) {
             return Item::totalWatched($range);
         }));
     }], 'User stats' => ['Registered' => function ($range) use($cache) {
         return mustard_number($cache->remember('total_users', config('mustard.dashboard_cache'), function () use($range) {
             return User::totalRegistered($range);
         }));
     }, 'Sellers' => function ($range) use($cache) {
         return mustard_number($cache->remember('total_sellers', config('mustard.dashboard_cache'), function () use($range) {
             return User::totalSellers($range);
         }));
     }]];
     if (mustard_loaded('auctions')) {
         $stats['User stats']['Bidders'] = function ($range) use($cache) {
             return mustard_number($cache->remember('total_bidders', config('mustard.dashboard_cache'), function () use($range) {
                 return User::totalBidders($range);
             }));
         };
         $stats['Item stats']['Bids placed'] = function ($range) use($cache) {
             return mustard_number($cache->remember('total_bids_placed', config('mustard.dashboard_cache'), function () use($range) {
                 return \Hamjoint\Mustard\Auctions\Bid::totalPlaced($range);
             }));
         };
         $stats['Item stats']['Average bid amount'] = function ($range) use($cache) {
             return mustard_price($cache->remember('average_bids', config('mustard.dashboard_cache'), function () use($range) {
                 return \Hamjoint\Mustard\Auctions\Bid::averageAmount($range);
             }));
         };
     }
     if (mustard_loaded('commerce')) {
         $stats['User stats']['Buyers'] = function ($range) use($cache) {
             return mustard_number($cache->remember('total_buyers', config('mustard.dashboard_cache'), function () use($range) {
                 return User::totalBuyers($range);
             }));
         };
         $stats['Transaction stats']['Purchases'] = function ($range) use($cache) {
             return mustard_number($cache->remember('total_purchases', config('mustard.dashboard_cache'), function () use($range) {
                 return \Hamjoint\Mustard\Commerce\Purchase::totalCreated($range);
             }));
         };
         $stats['Transaction stats']['Average amount'] = function ($range) use($cache) {
             return mustard_price($cache->remember('average_purchases', config('mustard.dashboard_cache'), function () use($range) {
                 return \Hamjoint\Mustard\Commerce\Purchase::averageAmount($range);
             }));
         };
     }
     $ranges = ['Today' => strtotime('midnight'), 'This week' => strtotime('monday this week'), 'This month' => strtotime('midnight first day of this month'), 'This year' => strtotime(date('Y') . '/01/01'), 'Overall' => 0];
     return view('mustard::admin.dashboard', ['ranges' => $ranges, 'stats' => $stats]);
 }
开发者ID:hamjoint,项目名称:mustard,代码行数:61,代码来源:AdminController.php


示例9: put

 public function put($request, $file)
 {
     if ($file) {
         $this->cache->put($this->makeCacheKey($request), $file, Carbon::now()->addMinutes(env('CACHE_EXPIRE_MINUTES')));
     }
     return $this;
 }
开发者ID:antonioribeiro,项目名称:lumen-image-processor,代码行数:7,代码来源:Cache.php


示例10: has

 /**
  * Has
  * @param $key
  * @return bool
  */
 public function has($key)
 {
     if ($this->cacheDriver == "file") {
         return $this->cache->has($key);
     }
     return $this->cache->tags($this->tag)->has($key);
 }
开发者ID:MehmetNuri,项目名称:fullycms,代码行数:12,代码来源:FullyCache.php


示例11: generate

 /**
  * Render weather widget.
  *
  * @param  array  $options
  * @return string
  */
 public function generate($options = array())
 {
     // Get options
     $options = array_merge($this->config['defaults'], $options);
     // Unify units
     $options['units'] = strtolower($options['units']);
     if (!in_array($options['units'], array('metric', 'imperial'))) {
         $options['units'] = 'imperial';
     }
     // Create cache key
     $cacheKey = 'Weather.' . md5(implode($options));
     // Check cache
     if ($this->config['cache'] && $this->cache->has($cacheKey)) {
         return $this->cache->get($cacheKey);
     }
     // Get current weather
     $current = $this->getWeather($options['query'], 0, $options['units'], 1);
     if ($current['cod'] !== 200) {
         return 'Unable to load weather';
     }
     // Get forecast
     $forecast = $this->getWeather($options['query'], $options['days'], $options['units']);
     // Render view
     $html = $this->view->make("{$this->config['views']}.{$options['style']}", array('current' => $current, 'forecast' => $forecast, 'units' => $options['units'], 'date' => $options['date']))->render();
     // Add to cache
     if ($this->config['cache']) {
         $this->cache->put($cacheKey, $html, $this->config['cache']);
     }
     return $html;
 }
开发者ID:torann,项目名称:laravel-weather,代码行数:36,代码来源:Weather.php


示例12: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->laravel['events']->fire('cache:clearing');
     $this->cache->flush();
     $this->laravel['events']->fire('cache:cleared');
     $this->info('Application cache cleared!');
 }
开发者ID:fparralejo,项目名称:btrabajo,代码行数:12,代码来源:ClearCommand.php


示例13: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->cache->flush();
     $this->files->delete($this->laravel['config']['app.manifest'] . '/services.json');
     $this->laravel['events']->fire('cache:cleared');
     $this->info('Application cache cleared!');
 }
开发者ID:arifmahmudrana,项目名称:angularjs-laravel-boilerplate,代码行数:12,代码来源:ClearCommand.php


示例14: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $storeName = $this->argument('store');
     $this->laravel['events']->fire('cache:clearing', [$storeName]);
     $this->cache->store($storeName)->flush();
     $this->laravel['events']->fire('cache:cleared', [$storeName]);
     $this->info('Application cache cleared!');
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:13,代码来源:ClearCommand.php


示例15: handle

 public function handle()
 {
     $storeName = $this->config->get('laravel-responsecache.cacheStore');
     $this->laravel['events']->fire('responsecache:clearing', [$storeName]);
     $this->cache->store($storeName)->flush();
     $this->laravel['events']->fire('responsecache:cleared', [$storeName]);
     $this->info('Response cache cleared!');
 }
开发者ID:mcarriere,项目名称:laravel-responsecache,代码行数:8,代码来源:ClearCommand.php


示例16: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if (null !== ($key = $this->argument('key'))) {
         $this->keys = [$key];
     }
     foreach ($this->keys as $key) {
         $this->cacheManager->store()->forget($key);
     }
     $this->cacheManager->store()->tags(['dbQueryCache'])->flush();
     $this->info('Clear cache successfully!');
 }
开发者ID:BePsvPT,项目名称:CCU,代码行数:16,代码来源:ClearCache.php


示例17: render

 /**
  * Render the homepage view for displaying.
  *
  * @param  string $name
  * @return string
  */
 public function render($name, $subname = 'Home.Content')
 {
     if ($this->cache->has('home.content')) {
         $content = $this->cache->get('home.content');
     } else {
         $slides = App::make('Lib\\Slides\\SlideRepository')->get();
         $news = App::make('Lib\\News\\NewsRepository')->latest(8);
         $content = $this->view->make($subname)->with('slides', $slides)->with('news', $news)->with('categories', $this->getCategories())->render();
         $this->cache->put('home.content', $content, 2880);
     }
     return $this->view->make($name)->with('content', $content);
 }
开发者ID:onlystar1991,项目名称:mtdb,代码行数:18,代码来源:HomepageRenderer.php


示例18: lookup

 /**
  * Lookup an item in the API.
  *
  * @param string $item
  * @param array  $params
  *
  * @return object
  */
 public function lookup($id, $value = null, $params = array())
 {
     $cacheKey = $this->cacheKey('lookup', $this->getLookupParams($id, $value, $params));
     $cacheDuration = $this->iTunesConfig['cache'];
     if ($this->cache->has($cacheKey)) {
         return $this->cache->get($cacheKey);
     } else {
         return $this->cache->remember($cacheKey, $cacheDuration, function () use($id, $value, $params) {
             return json_encode(parent::lookup($id, $value, $params));
         });
     }
 }
开发者ID:vinelab,项目名称:itunes,代码行数:20,代码来源:LaravelAgent.php


示例19: handle

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     $tags = array_filter(explode(',', $this->option('tags')));
     $cache = $this->cache->store($store = $this->argument('store'));
     $this->laravel['events']->fire('cache:clearing', [$store, $tags]);
     if (!empty($tags)) {
         $cache->tags($tags)->flush();
     } else {
         $cache->flush();
     }
     $this->info('Cache cleared successfully.');
     $this->laravel['events']->fire('cache:cleared', [$store, $tags]);
 }
开发者ID:davidhemphill,项目名称:framework,代码行数:18,代码来源:ClearCommand.php


示例20: set

 /**
  * @param $key
  * @param $value
  * @return bool
  */
 public function set($key, $value)
 {
     $setting = Setting::whereKey($key)->first();
     if (!is_object($setting)) {
         $setting = new Setting();
         $setting->key = $key;
     }
     $setting->value = $value;
     $setting->save();
     if ($this->application->isInstalled()) {
         $this->cache->forget($this->cache_key);
     }
     return true;
 }
开发者ID:darrengopower,项目名称:framework,代码行数:19,代码来源:Factory.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Cache\FileStore类代码示例发布时间:2022-05-23
下一篇:
PHP Bus\Dispatcher类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap