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!'); }
/** * 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!'); }
/** * 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!'); }
/** * 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]); }
/** * 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')); }
/** * Get a cache store instance by name. * * @param string|null $name * @return mixed * @static */ public static function store($name = null) { return \Illuminate\Cache\CacheManager::store($name); }
/** * Execute the console command. * * @return void */ public function handle() { $this->cache->store($this->argument('store'))->forget($this->argument('key')); $this->info('The [' . $this->argument('key') . '] key has been removed from the cache.'); }
/** * @return mixed|null */ public static function getCache() { $Factory = self::getInstance(); if (!$Factory->Cache) { if ($Factory->App) { # Use Laravel cache: $Factory->Cache = $Factory->App['cache']; } else { # Create cache manager: if ($cache = $Factory->config['cache']) { switch ($cache['default']) { case 'redis': $Factory->Container['redis'] = new Database($Factory->config['database']['redis']); break; case 'memcached': $Factory->Container['memcached.connector'] = new MemcachedConnector(); break; } $CacheManager = new CacheManager($Factory->Container); $Factory->Cache = $CacheManager->store(); } } } return $Factory->Cache; }
use Illuminate\Container\Container; use Illuminate\Filesystem\Filesystem; require_once 'vendor/autoload.php'; /** * Illuminate/config * * @source https://github.com/illuminate/config */ $app = new \Slim\Slim(); $app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware()); $app->get('/', function () { // Create a new Container object, needed by the cache manager. $container = new Container(); // The CacheManager creates the cache "repository" based on config values // which are loaded from the config class in the container. // More about the config class can be found in the config component; for now we will use an array $container['config'] = ['cache.default' => 'file', 'cache.stores.file' => ['driver' => 'file', 'path' => __DIR__ . '/cache']]; // To use the file cache driver we need an instance of Illuminate's Filesystem, also stored in the container $container['files'] = new Filesystem(); // Create the CacheManager $cacheManager = new CacheManager($container); // Get the default cache driver (file in this case) $cache = $cacheManager->store(); // Or, if you have multiple drivers: // $cache = $cacheManager->store('file'); // Store a value into cache for 500 minutes $cache->put('test', 'This is loaded from cache.', 500); // Echo out the value we just stored in cache echo $cache->get('test'); }); $app->run();
/** * Create a new RollbackHandler instance. * * @param CacheManager $cache */ public function __construct(CacheManager $cache) { $this->cache = $cache->store(); }