配置必须包含“适配器”。拉米纳纳斯框架的钥匙

发布于 2025-01-23 00:49:21 字数 1070 浏览 0 评论 0原文

reciénrealice el Modulo laminas/laminas-cache alaversión ^3.1.3 y al Mountso de ejecutar mi desarrollo me lanza el lanza el Siguiente错误:

Fatal error: Uncaught InvalidArgumentException: Configuration must contain a "adapter" key. in C:\xampp\htdocs\bisef\vendor\laminas\laminas-cache\src\Service\StorageAdapterFactory.php:85

miconfiguraciónen global.php es la siguiente:php es la siguiente:

'caches' => [
        'FilesystemCache' => [
            'adapter' => [
                'name' => Filesystem::class,
                'options' => [
                    // Store cached data in this directory.
                    'cache_dir' => './data/cache',
                    // Store cached data for 1 hour.
                    'ttl' => 60 * 60 * 1
                ],
            ],
            'plugins' => [
                [
                    'name' => 'serializer',
                    'options' => [
                    ],
                ],
            ],
        ],
    ],

recién actualice el modulo laminas/laminas-cache a la versión ^3.1.3 y al momento de ejecutar mi desarrollo me lanza el siguiente error:

Fatal error: Uncaught InvalidArgumentException: Configuration must contain a "adapter" key. in C:\xampp\htdocs\bisef\vendor\laminas\laminas-cache\src\Service\StorageAdapterFactory.php:85

Mi configuración en global.php es la siguiente:

'caches' => [
        'FilesystemCache' => [
            'adapter' => [
                'name' => Filesystem::class,
                'options' => [
                    // Store cached data in this directory.
                    'cache_dir' => './data/cache',
                    // Store cached data for 1 hour.
                    'ttl' => 60 * 60 * 1
                ],
            ],
            'plugins' => [
                [
                    'name' => 'serializer',
                    'options' => [
                    ],
                ],
            ],
        ],
    ],

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左秋 2025-01-30 00:49:21

如错误消息所说,适配器键丢失。
正确的配置应如下:

'caches' => [
    'adapter' => \Laminas\Cache\Storage\Adapter\Filesystem::class,
    'options' => [
        // Store cached data in this directory.
        'cache_dir' => './data/cache',
        // Store cached data for 1 hour.
        'ttl' => 60 * 60 * 1
    ],
    'plugins' => [
        [
            'name' => 'serializer',
            'options' => []
        ]
    ]
],

如果您使用多个缓存,并且需要将它们分开(如摘要所示),那么:

'caches' => [
    'FilesystemCache' => [
        'adapter' => \Laminas\Cache\Storage\Adapter\Filesystem::class,
        'options' => [
            // Store cached data in this directory.
            'cache_dir' => './data/cache',
            // Store cached data for 1 hour.
            'ttl' => 60 * 60 * 1
        ],
        'plugins' => [
            [
                'name' => 'serializer',
                'options' => []
            ]
        ]
    ]
]

as said by the error message, the adapter key is missing.
The correct configuration should the following:

'caches' => [
    'adapter' => \Laminas\Cache\Storage\Adapter\Filesystem::class,
    'options' => [
        // Store cached data in this directory.
        'cache_dir' => './data/cache',
        // Store cached data for 1 hour.
        'ttl' => 60 * 60 * 1
    ],
    'plugins' => [
        [
            'name' => 'serializer',
            'options' => []
        ]
    ]
],

In case you are using multiple caches and you need to separate them (as shown by your snippet), then:

'caches' => [
    'FilesystemCache' => [
        'adapter' => \Laminas\Cache\Storage\Adapter\Filesystem::class,
        'options' => [
            // Store cached data in this directory.
            'cache_dir' => './data/cache',
            // Store cached data for 1 hour.
            'ttl' => 60 * 60 * 1
        ],
        'plugins' => [
            [
                'name' => 'serializer',
                'options' => []
            ]
        ]
    ]
]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文