我想摆脱使用Cache Facade并使用构造函数将其注入我的控制器,如下所示:
use Illuminate\Contracts\Cache\Store;
...
protected $cache;
public function __construct(Store $cache)
{
$this->cache = $cache;
}
Run Code Online (Sandbox Code Playgroud)
然后我在AppServiceProvider.php中使用app绑定.
public function register()
{
$this->app->bind(
'Illuminate\Contracts\Cache\Store',
'Illuminate\Cache\FileStore'
);
}
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下错误,因为FileStore.php需要构造函数中的$ files和$ directory参数.
Container.php第872行中的BindingResolutionException:类Illuminate\Cache\FileStore中无法解析的依赖项解析[Parameter#1 [$ directory]]
知道如何解决这个问题吗?
我有一个可以从 API 网关或 ALB 请求触发的 Lambda 函数。我还有一个 RDS Aurora PostgreSQL 实例,它们都在 VPC 中运行。
我能够从 Lambda 连接到 RDS 实例就好了,但是我无法访问互联网,例如尝试向https://jsonplaceholder.typicode.com/todos/1发出请求将导致超时.
我也无法使用 DBeaver 等 SQL 客户端连接到远程数据库。
下面是一些详细信息,但如果您需要其他任何东西,请告诉我。我难住了。
Lambda 入站规则
Security group ID Ports Source
sg-0f2c4426c8fc85235 80 0.0.0.0/0
sg-0f2c4426c8fc85235 5432 0.0.0.0/0
sg-0f2c4426c8fc85235 All sg-0f2c4426c8fc85235
sg-0f2c4426c8fc85235 22 0.0.0.0/0
sg-0f2c4426c8fc85235 443 0.0.0.0/0
Run Code Online (Sandbox Code Playgroud)
Lambda 出站规则
Security group ID Ports Destination
sg-0f2c4426c8fc85235 All 0.0.0.0/0
Run Code Online (Sandbox Code Playgroud)
RDS 连接

专有网络

公共子网

私有子网

编辑
Nat 网关(与公共子网关联)

路由表

路由表路由



编辑 2
Lambda 子网
