docbrown/app/services/edge_cache/bust_listings.rb
Alex d109b6824e
Refactor cache purging (#12811)
* Refactor caching

* Bring back old bust class

* Refactor with PR feedback

* Remove useless return values
2021-03-02 10:09:05 -05:00

17 lines
540 B
Ruby

module EdgeCache
class BustListings
def self.call(listing)
return unless listing
# we purge all listings as it's the wanted behavior with the following URL purging
listing.purge_all
cache_bust = EdgeCache::Bust.new
cache_bust.call("/listings")
cache_bust.call("/listings?i=i")
cache_bust.call("/listings/#{listing.category}/#{listing.slug}")
cache_bust.call("/listings/#{listing.category}/#{listing.slug}?i=i")
cache_bust.call("/listings/#{listing.category}")
end
end
end