Rails.cache.delete不起作用

问题描述 投票:0回答:1

嗨,我是Rails的新手,我试图从Rails缓存中删除密钥,如下所示:

Rails.cache.fetch('datasources_field_options')

我在rails控制台中看到一个很大的数组然后我尝试像这样删除它:

 Rails.cache.delete('datasources_field_options')

此返回true这是从控制台:

irb(main):004:0> Rails.cache.delete('datasources_field_options')
2019-09-26 14:45:56 +0000 1569509156754 (24618) Cache delete: datasources_field_options
=> true
irb(main):005:0>

然后我再次检查它是否被删除:

Rails.cache.fetch('datasources_field_options')

缓存类型为ActiveSupport::Cache::DalliStore

不,不是。数组仍然在那里。

我想念的是什么?为什么不能从缓存中删除特定密钥?

ruby-on-rails caching dalli
1个回答
0
投票

发布者回复后,我将删除此答案。您如何定义?

config.cache_store
© www.soinside.com 2019 - 2024. All rights reserved.