To improve performance rendered state views can be cached using Rails’ caching mechanism. If this it configured (e.g. using our fast friend memcached) all you have to do is to tell Cells which state you want to cache. You can further attach a proc to expire the cached view.
As always I stole a lot of code, this time from Lance Ivy
(Not documented)
# File lib/cell/caching.rb, line 149 def cache_options; self.class.cache_options; end
Call the versioning Proc for the respective state.
# File lib/cell/caching.rb, line 134 def call_version_proc_for_state(state) version_proc = version_procs[state] return {} unless version_proc # call to #cache was without any args. return version_proc.call(self) if version_proc.kind_of? Proc send(version_proc) end
(Not documented)
# File lib/cell/caching.rb, line 106 def render_state_with_caching(state) return render_state_without_caching(state) unless state_cached?(state) key = cache_key(state, call_version_proc_for_state(state)) ### DISCUSS: see sweep discussion at #cache. # cache hit: if content = read_fragment(key) return content end # re-render: return write_fragment(key, render_state_without_caching(state), cache_options[state]) end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.