本文整理汇总了PHP中Illuminate\Cache\CacheManager::store方法的典型用法代码示例。如果您正苦于以下问题:PHP CacheManager::store方法的具体用法?PHP CacheManager::store怎么用?PHP CacheManager::store使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Cache\CacheManager
的用法示例。
在下文中一共展示了CacheManager::store方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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!');
}
示例2: 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!');
}
示例3: 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!');
}
示例4: 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]);
}
示例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'));
}
示例6: store
/**
* 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);
}
示例7: handle
/**
* 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.');
}
示例8: getCache
/**
* @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;
}
示例9: function
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();
示例10: __construct
/**
* Create a new RollbackHandler instance.
*
* @param CacheManager $cache
*/
public function __construct(CacheManager $cache)
{
$this->cache = $cache->store();
}