AbstractStrategyStore
Store well suited for action caching.
# File lib/merb-cache/stores/strategy/action_store.rb, line 42 def delete(dispatch, parameters = {}) if writable?(dispatch, parameters) @stores.map {|s| s.delete(normalize(dispatch), parameters)}.any? end end
# File lib/merb-cache/stores/strategy/action_store.rb, line 48 def delete_all! @stores.map {|s| s.delete_all!}.all? end
# File lib/merb-cache/stores/strategy/action_store.rb, line 36 def exists?(dispatch, parameters = {}) if writable?(dispatch, parameters) @stores.capture_first {|s| s.exists?(normalize(dispatch), parameters)} end end
# File lib/merb-cache/stores/strategy/action_store.rb, line 30 def fetch(dispatch, parameters = {}, conditions = {}, &blk) if writable?(dispatch, parameters, conditions) read(dispatch, parameters) || @stores.capture_first {|s| s.fetch(normalize(dispatch), data || dispatch.body, parameters, conditions, &blk)} end end
# File lib/merb-cache/stores/strategy/action_store.rb, line 52 def normalize(dispatch) "#{dispatch.class.name}##{dispatch.action_name}" unless dispatch.class.name.blank? || dispatch.action_name.blank? end
# File lib/merb-cache/stores/strategy/action_store.rb, line 12 def read(dispatch, parameters = {}) if writable?(dispatch, parameters) @stores.capture_first {|s| s.read(normalize(dispatch), parameters)} end end
# File lib/merb-cache/stores/strategy/action_store.rb, line 4 def writable?(dispatch, parameters = {}, conditions = {}) case dispatch when Merb::Controller @stores.any?{|s| s.writable?(normalize(dispatch), parameters, conditions)} else false end end
# File lib/merb-cache/stores/strategy/action_store.rb, line 18 def write(dispatch, data = nil, parameters = {}, conditions = {}) if writable?(dispatch, parameters, conditions) @stores.capture_first {|s| s.write(normalize(dispatch), data || dispatch.body, parameters, conditions)} end end
# File lib/merb-cache/stores/strategy/action_store.rb, line 24 def write_all(dispatch, data = nil, parameters = {}, conditions = {}) if writable?(dispatch, parameters, conditions) @stores.map {|s| s.write_all(normalize(dispatch), data || dispatch.body, parameters, conditions)}.all? end end
Generated with the Darkfish Rdoc Generator 2.