Optimized code of async-queue, cache, command, config

This commit is contained in:
李铭昕 2020-05-13 13:58:44 +08:00
parent 251eda809c
commit d696a67b6f
7 changed files with 14 additions and 8 deletions

View File

@ -43,6 +43,9 @@ before_script:
script:
- composer analyse \
src/amqp \
src/async-queue
src/async-queue \
src/cache \
src/command \
src/config
- composer test -- --exclude-group NonCoroutine
- vendor/bin/phpunit --group NonCoroutine

View File

@ -18,7 +18,6 @@ use Hyperf\Cache\Driver\KeyCollectorInterface;
use Hyperf\Di\Annotation\Aspect;
use Hyperf\Di\Aop\AbstractAspect;
use Hyperf\Di\Aop\ProceedingJoinPoint;
use Psr\Container\ContainerInterface;
/**
* @Aspect
@ -32,7 +31,7 @@ class CacheableAspect extends AbstractAspect
];
/**
* @var ContainerInterface
* @var CacheManager
*/
protected $manager;

View File

@ -18,7 +18,6 @@ use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Di\Annotation\Aspect;
use Hyperf\Di\Aop\AbstractAspect;
use Hyperf\Di\Aop\ProceedingJoinPoint;
use Psr\Container\ContainerInterface;
/**
* @Aspect
@ -32,7 +31,7 @@ class FailCacheAspect extends AbstractAspect
];
/**
* @var ContainerInterface
* @var CacheManager
*/
protected $manager;

View File

@ -51,6 +51,8 @@ class CoroutineMemoryDriver extends Driver implements KeyCollectorInterface
foreach ($values as $key => $value) {
$this->set($key, $values, $ttl);
}
return true;
}
public function deleteMultiple($keys)
@ -58,6 +60,8 @@ class CoroutineMemoryDriver extends Driver implements KeyCollectorInterface
foreach ($keys as $key) {
$this->delete($key);
}
return true;
}
public function has($key)

View File

@ -113,7 +113,7 @@ class RedisDriver extends Driver implements KeyCollectorInterface
return $this->getCacheKey($key);
}, $keys);
return $this->redis->del(...$cacheKeys);
return (bool) $this->redis->del(...$cacheKeys);
}
public function has($key)

View File

@ -40,7 +40,7 @@ abstract class Command extends SymfonyCommand
protected $input;
/**
* @var OutputInterface|SymfonyStyle
* @var SymfonyStyle
*/
protected $output;

View File

@ -28,6 +28,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class ModelCommand extends Command
{
@ -57,7 +58,7 @@ class ModelCommand extends Command
protected $printer;
/**
* @var OutputInterface
* @var SymfonyStyle
*/
protected $output;