```php
/**
* 服务工厂类
* 统一管理服务实例创建,实现单例模式,支持依赖注入
*/
class ServiceFactory
{
/**
* 服务实例缓存*/
private static array $instances = [];
/**
* 获取缓存服务实例
*/
public static functionCacheService($redis, $prefix);
}
return self::$instances[$key];
}
}
```
```php
/**
* 缓存服务