Sha256: 3d39b2a4647ea4869fb97588d9af8e2e85d7cc7ab940989ed434d17f5ab8bc16
Contents?: true
Size: 972 Bytes
Versions: 2
Compression:
Stored size: 972 Bytes
Contents
require 'fileutils' module Nitro # Adds support for caching. module Caching # Action caching. module Actions def self.append_features(base) # :nodoc: super base.extend(ClassMethods) end module ClassMethods def cache_action(*actions) return unless caching_enabled? before_filter( %{ fragment_name = "\#\{@action_name\}\#{@request.query_string}" if fragment = Fragment.get(fragment_name) @out = fragment return end }, :only => actions ) after_filter( %{ fragment_name = "\#\{@action_name\}\#{@request.query_string}" Fragment.put(fragment_name, @out) }, :only => actions ) end end private #-- # FIXME: not implemented. #++ def expire_action(*actions) return unless caching_enabled? for action in [actions].flatten expire_fragment(action) end end end end end # * George Moschovitis <gm@navel.gr>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.19.0 | lib/nitro/caching/actions.rb |
nitro-0.20.0 | lib/nitro/caching/actions.rb |