```php
/**
* 服务工厂类
* 统一管理服务实例创建,实现单例模式,支持依赖注入
*/
class ServiceFactory
{
/**
* 服务实例缓存getCacheService();
$cacheKey = 'key';
$this->cacheService->get($cacheKey);
```
### 问题1
rPush定义了int|bool返回类型,在管道下返回的是redis对象报错
```php
Return value must be of type int|bool, Redis returned
```
解决方法是立即去掉返回类型后重启string, Redis returned
```
(问号脸) (问号脸) (问号脸)
想到了问题1,马上去修改返回类型,又想到了get它怎么会有类型有问题(问号脸)
去看了一下伪代码1使用了管道,这个时候电话来了开启管道
foreach ($idMap as $id) {
$redis->rPush($cacheKey, $id);
}
$redis->exec(); // 提交
```
思考了一会其实不改