The discussion revolves around clearing the Onebox cache in Discourse. fefrei reports that cached Onebox previews persist even after plugin updates, affecting testing. codinghorror suggests adding a random querystring to bypass the cache temporarily. zogstrip confirms the cache expires after 24 hours and mentions the redis-cli flushall command as a way to purge it, though warns it also clears Sidekiq’s queue. mcdanlj provides a more targeted solution: using redis-cli to delete specific Onebox cache keys by pattern, such as keys *CACHE:onebox*example.com*, followed by del to remove them without affecting other Redis data.
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.
في واجهة سطر الأوامر الخاصة بـ Redis، يمكنك أيضًا حذف مفاتيح فردية دون تفريغ ذاكرة التخزين المؤقت لـ 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* للبحث عن المفتاح المخزن في الذاكرة المؤقتة لحذفه…
يمكنني تأكيد أنني نجحت في حذف oneboxes المخزنة وإعادة بناء HTML للمشاركات المتأثرة ببيانات معطلة مخزنة باستخدام هذه الطريقة.