docbrown/app/workers/comments/bust_cache_worker.rb
Alex 7ee8523ba3
Refactor EdgeCache (#11684)
* Refactor EdgeCache

* Update specs

* Add bust comment spec

* Fix more specs

* Use const_get

* Make methods private

* Add .discussion? decorator to Article

* Change variable name to article for clarity
2020-12-02 14:20:22 -05:00

13 lines
310 B
Ruby

module Comments
class BustCacheWorker < BustCacheBaseWorker
def perform(comment_id)
comment = Comment.find_by(id: comment_id)
return unless comment&.commentable
comment.purge
comment.commentable.purge
EdgeCache::BustCommentable.call(comment.commentable)
end
end
end