Class: ProductCategory::CacheFlusher

Inherits:
BaseService show all
Defined in:
app/services/product_category/cache_flusher.rb

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #options, #tagged_logger

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#process(product_category_or_id) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'app/services/product_category/cache_flusher.rb', line 2

def process(product_category_or_id)
  product_category = if product_category_or_id.is_a?(ProductCategory)
                       product_category_or_id
                     else
                       ProductCategory.find(product_category_or_id)
                     end
  product_category.descendants.each(&:touch)
  Rails.cache.delete(:product_categories_no_follow_ups_ids)
end