我的Laravel应用程序出现以下错误:
BadMethodCallException
This cache store does not support tagging.
但是,在我的.env中,我设置了CACHE_DRIVER=array
或redis
。
由于这个问题,我无法使用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
如果它已经为空,请尝试将其设置为false
或null
。希望它能有所帮助!
使用php artisan optimize:clear命令对我很有效。它清除了所有内容,我猜清除配置缓存就足够了。