Sha256: 9b0f192e5925e0ef373c36ad5d23c257117fa197741d67db6d96303dd4301dff

Contents?: true

Size: 516 Bytes

Versions: 9

Compression:

Stored size: 516 Bytes

Contents

class StructureSweeper < ActionController::Caching::Sweeper
	observe Structure
	
	def after_create(item)
		expire(item)
	end
	
	def after_update(item)
		expire(item)
	end
	
	def after_destroy(item)
		expire(item)
	end
	
	# Clear all orders cache files
	def self.sweep!
	  cache_store = Rails.application.config.action_controller.cache_store
	  cache_store.clear if cache_store
	    
    Rails.logger.info("StructureSweeper clear all cache")
	end
	
	private
	
	  def expire(item=nil)
		  self.class.sweep!
	  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
sunrise-core-0.1.3 lib/generators/sunrise/templates/sweepers/structure_sweeper.rb
sunrise-core-0.1.2 lib/generators/sunrise/templates/sweepers/structure_sweeper.rb
sunrise-core-0.1.1 lib/generators/sunrise/templates/sweepers/structure_sweeper.rb
sunrise-core-0.1.0 lib/generators/sunrise/templates/sweepers/structure_sweeper.rb
freeberry-0.3.0 lib/generators/freeberry/base/templates/sweepers/structure_sweeper.rb
freeberry-0.2.9 lib/generators/freeberry/base/templates/sweepers/structure_sweeper.rb
freeberry-0.2.7 lib/generators/freeberry/base/templates/sweepers/structure_sweeper.rb
freeberry-0.2.6 lib/generators/freeberry/base/templates/sweepers/structure_sweeper.rb
freeberry-0.2.5 lib/generators/freeberry/base/templates/sweepers/structure_sweeper.rb