fefrei
(Felix Freiberger)
2016 年2 月 24 日 08:36
1
I’m developing a small Onebox plugin and testing it in my production install.
It appears that Discourse is caching the Oneboxes: When I paste a link I once saw oneboxed into a new post, the preview is still looking as if it was generated by an older version of the plugin, while newer links appear as they should. All this is happening in the preview, I’m not actually posting the link.
How can I clear this cache?
Adding a rando querystring is usually the best quick & dirty way.
2 个赞
fefrei
(Felix Freiberger)
2016 年2 月 24 日 09:31
3
Yes, that works – but only to circumvent the cache for testing, not to clear it for end users.
Is there a way to really purge this cache? Does it expire eventually?
There’s always the option to redis-cli flushall.
Yup, it’ll automatically expire after 24 hours.
3 个赞
fefrei
(Felix Freiberger)
2016 年2 月 24 日 09:40
5
Great – this helps a lot. Thanks!
all the caches!
1 个赞
Be aware that flushing redis will clear sidekiq’s queue (and thus might end up losing some email notifications )
6 个赞
mcdanlj
(Michael K Johnson)
2021 年1 月 18 日 18:32
7
在 Redis CLI 中,您也可以删除单个键,而无需刷新整个 Redis 缓存:
# ./launcher enter app
# redis-cli
> keys *CACHE:onebox*example.com*
1) `"default: CACHE:onebox__https://example.com/"`
> del "default: CACHE:onebox__https://example.com/"
(integer) 1
> keys *CACHE:onebox*example.com*
(empty list or set)
我预计这种键模式不太会频繁变更,但如果确实发生了变化,您可以直接使用 keys *onebox*url* 甚至 keys *url* 来查找需要删除的缓存键……
我可以确认,使用此方法已成功删除了缓存的 onebox 数据,并为受缓存损坏数据影响的帖子重新生成了 HTML。
9 个赞