Class: DeadSimpleCMS::Rack::SectionRefresher
- Inherits:
-
Object
- Object
- DeadSimpleCMS::Rack::SectionRefresher
- 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
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ SectionRefresher
constructor
A new instance of SectionRefresher.
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, = {}) @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 |