RedisClearCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Rottenwood\KingdomBundle\Command\Console;
4
5
use Rottenwood\KingdomBundle\Redis\RedisClientInterface;
6
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/** {@inheritDoc} */
11
class RedisClearCommand extends ContainerAwareCommand
12
{
13
14
    /** {@inheritDoc} */
15
    protected function configure()
16
    {
17
        $this->setName('kingdom:redis:clear');
18
        $this->setDescription('Очистка данных в redis');
19
    }
20
21
    /** {@inheritDoc} */
22
    protected function execute(InputInterface $input, OutputInterface $output)
23
    {
24
        /** @var \Redis $redis */
25
        $redis = $this->getContainer()->get('snc_redis.default');
26
        $redis->del(RedisClientInterface::ID_USERNAME_HASH);
27
        $redis->del(RedisClientInterface::ID_SESSION_HASH);
28
        $redis->del(RedisClientInterface::SESSION_ID_HASH);
29
        $redis->del(RedisClientInterface::ONLINE_LIST);
30
31
        $output->writeln('Данные удалены из redis');
32
    }
33
}
34