Class: DeadSimpleCMS::Rack::SectionRefresher

Inherits:
Object
  • Object
show all
Defined in:
lib/dead_simple_cms/rack/section_refresher.rb

Overview

Public: Refresh the DeadSimpleCMS values in between requests. Since DeadSimpleCMS stores all the attributes for a section in a serialized format, we cache the storage mechanism on a per-request basis to avoid unnecessary hits to the cache, whether it be Redis, Memcache, or the Database.

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ SectionRefresher

Returns a new instance of SectionRefresher.



9
10
11
# File 'lib/dead_simple_cms/rack/section_refresher.rb', line 9

def initialize(app, options = {})
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
# File 'lib/dead_simple_cms/rack/section_refresher.rb', line 13

def call(env)
  DeadSimpleCMS.sections.values.each(&:refresh!)
  @app.call(env)
end