@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $this |
56 | 56 | ->setName('phpfastcache:del') |
57 | - ->setAliases([ 'phpfastcache:delete', 'phpfastcache:rem', 'phpfastcache:remove']) |
|
57 | + ->setAliases(['phpfastcache:delete', 'phpfastcache:rem', 'phpfastcache:remove']) |
|
58 | 58 | ->setDescription('Delete phpfastcache cache value') |
59 | 59 | ->addArgument( |
60 | 60 | 'driver', |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | $driver = $input->getArgument('driver'); |
82 | 82 | $cacheKey = $input->getArgument('key'); |
83 | 83 | |
84 | - if (\array_key_exists($driver, $caches[ 'drivers' ])) { |
|
84 | + if (\array_key_exists($driver, $caches['drivers'])) { |
|
85 | 85 | $io->section($driver); |
86 | 86 | $driverInstance = $this->phpfastcache->get($driver); |
87 | 87 | $cacheItem = $driverInstance->getItem($cacheKey); |
88 | 88 | |
89 | - if(!$cacheItem->isHit()){ |
|
89 | + if (!$cacheItem->isHit()) { |
|
90 | 90 | $io->note(\sprintf('Cache item "%s" does not exists in the cache', $cacheKey)); |
91 | - }else{ |
|
91 | + } else { |
|
92 | 92 | $driverInstance->deleteItem($cacheItem->getKey()); |
93 | 93 | $io->success(\sprintf('Cache item "%s" has been deleted from cache', $cacheKey)); |
94 | 94 | } |
@@ -80,23 +80,23 @@ |
||
80 | 80 | $driver = $input->getArgument('driver'); |
81 | 81 | $cacheKey = $input->getArgument('key'); |
82 | 82 | |
83 | - if (\array_key_exists($driver, $caches[ 'drivers' ])) { |
|
83 | + if (\array_key_exists($driver, $caches['drivers'])) { |
|
84 | 84 | $io->section($driver); |
85 | 85 | $cacheItem = $this->phpfastcache->get($driver)->getItem($cacheKey); |
86 | 86 | |
87 | - if($cacheItem->isHit()){ |
|
87 | + if ($cacheItem->isHit()) { |
|
88 | 88 | $cacheItemValue = $cacheItem->get(); |
89 | - if(!\is_object($cacheItemValue)){ |
|
89 | + if (!\is_object($cacheItemValue)) { |
|
90 | 90 | ob_start(); |
91 | 91 | var_dump($cacheItemValue); |
92 | 92 | $content = ob_get_contents(); |
93 | 93 | ob_end_clean(); |
94 | 94 | $io->write('<bg=green;fg=black>[HIT]</> ' . $content); |
95 | - }else{ |
|
95 | + } else { |
|
96 | 96 | $io->write('<bg=green;fg=black>[HIT]</> (object) ' . \get_class($cacheItemValue)); |
97 | 97 | } |
98 | - $io->write('This item will expires in <fg=green>' . $cacheItem->getTtl() .'</> second(s)'); |
|
99 | - }else{ |
|
98 | + $io->write('This item will expires in <fg=green>' . $cacheItem->getTtl() . '</> second(s)'); |
|
99 | + } else { |
|
100 | 100 | $io->write('<bg=yellow;fg=red>[MISS]</> The cache item "' . $cacheKey . '" does not (yet) exists !'); |
101 | 101 | } |
102 | 102 | } else { |
@@ -92,16 +92,16 @@ |
||
92 | 92 | $cacheValue = $input->getArgument('value'); |
93 | 93 | $cacheTtl = $input->getArgument('ttl'); |
94 | 94 | |
95 | - if (\array_key_exists($driver, $caches[ 'drivers' ])) { |
|
95 | + if (\array_key_exists($driver, $caches['drivers'])) { |
|
96 | 96 | $io->section($driver); |
97 | 97 | $driverInstance = $this->phpfastcache->get($driver); |
98 | 98 | $cacheItem = $driverInstance->getItem($cacheKey); |
99 | 99 | $cacheItem->set($cacheValue); |
100 | 100 | |
101 | - if($cacheTtl){ |
|
102 | - if(\is_numeric($cacheTtl)){ |
|
101 | + if ($cacheTtl) { |
|
102 | + if (\is_numeric($cacheTtl)) { |
|
103 | 103 | $cacheItem->expiresAfter($cacheTtl); |
104 | - }else{ |
|
104 | + } else { |
|
105 | 105 | $io->error(\sprintf('Invalid ttl value format "%s", must be a valid integer, aborting...', $cacheTtl)); |
106 | 106 | return; |
107 | 107 | } |