【发布时间】:2016-12-27 19:13:21
【问题描述】:
一旦部署发生,我需要实现一种从 composer.json 文件中清除 redis 缓存的方法。 snc redis bundle 命令是这样的:
namespace Snc\RedisBundle\Command;
/**
* Symfony command to execute redis flushall
*
*/
class RedisFlushallCommand extends RedisBaseCommand
{
/**
* {@inheritDoc}
*/
protected function configure()
{
parent::configure();
$this->setName('redis:flushall')
->setDescription('Flushes the redis database using the redis flushall command');
}
/**
* {@inheritDoc}
*/
protected function executeRedisCommand()
{
if ($this->proceedingAllowed()) {
$this->flushAll();
} else {
$this->output->writeln('<error>Flushing cancelled</error>');
}
}
/**
* Flushing all redis databases
*/
private function flushAll()
{
$this->redisClient->flushall();
$this->output->writeln('<info>All redis databases flushed</info>');
}
}
如何将它包含在源代码根文件的composer.json 文件中?我知道可能有一种非常简单的方法可以做到这一点,但我就是想不通。
【问题讨论】:
标签: php composer-php symfony