清除缓存时删除redis键
delete redis keys when clearing cache
项目配置:symfony 5.
我在 config\packages\cache.yml
中将我的缓存配置为使用 redis
framework:
cache:
prefix_seed: myAppPrefix_
app: cache.adapter.redis
system: cache.adapter.filesystem
default_redis_provider: '%env(REDIS_URL)%'
当i运行php bin/console cache:clear --env=dev
时,redis键没有被删除,没有过期
cache:clear
命令不应该删除密钥或使密钥过期?
我可以删除所有与我的应用程序前缀匹配的密钥吗?
感谢您的帮助
我没有找到任何参考资料确认 cache:clear 应该清除链接到我的配置的 redis 密钥。
最后,我创建了一个命令(注入“AdapterInterface”)以使用该代码清理它们:
public function __construct(AdapterInterface $cache)
{
...
$this->cache= $cache;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->redis->clear();
}
小心,在windows上它不起作用,因为redis版本在RedisTrait:356
中是空的
项目配置:symfony 5.
我在 config\packages\cache.yml
中将我的缓存配置为使用 redis
framework:
cache:
prefix_seed: myAppPrefix_
app: cache.adapter.redis
system: cache.adapter.filesystem
default_redis_provider: '%env(REDIS_URL)%'
当i运行php bin/console cache:clear --env=dev
时,redis键没有被删除,没有过期
cache:clear
命令不应该删除密钥或使密钥过期?
我可以删除所有与我的应用程序前缀匹配的密钥吗?
感谢您的帮助
我没有找到任何参考资料确认 cache:clear 应该清除链接到我的配置的 redis 密钥。
最后,我创建了一个命令(注入“AdapterInterface”)以使用该代码清理它们:
public function __construct(AdapterInterface $cache)
{
...
$this->cache= $cache;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->redis->clear();
}
小心,在windows上它不起作用,因为redis版本在RedisTrait:356
中是空的