Laravel:这个缓存存储不支持使用数组或redis进行标记



我的Laravel应用程序出现以下错误:

BadMethodCallException
This cache store does not support tagging.

但是,在我的.env中,我设置了CACHE_DRIVER=arrayredis

由于这个问题,我无法使用spatie/laravel responsecache。

重新安装我的应用程序没有帮助。

也许某个程序包干扰了我的应用程序,但问题是新出现的。这是我的composer.json:

"require": {
"php": "^7.3",
"ext-json": "*",
"doctrine/dbal": "^2.9",
"felixinx/gtfs-realtime-protobuf-php": "@dev",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^6.0",
"laravel/horizon": "^3.2",
"laravel/tinker": "^1.0",
"league/csv": "^9.1",
"mad-web/laravel-initializer": "^2.0",
"predis/predis": "^1.1",
"pusher/pusher-php-server": "~4.0",
"spatie/laravel-responsecache": "^6.3",
"symfony/psr-http-message-bridge": "^1.1"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},

您需要定义RESPONSE_CACHE_DRIVER环境变量:

RESPONSE_CACHE_DRIVER=array|redis|memcached

检查config/responsecache.php文件上的cache_tag

/*
* If the cache driver you configured supports tags, you may specify a tag name
* here. All responses will be tagged. When clearing the responsecache only
* items with that tag will be flushed.
*
* You may use a string or an array here.
*/
'cache_tag' => '',  // <-- make sure this is empty

如果它已经为空,请尝试将其设置为falsenull。希望它能有所帮助!

使用php artisan optimize:clear命令对我很有效。它清除了所有内容,我猜清除配置缓存就足够了。

最新更新