ActionController::Caching::Fragments

Public Instance Methods

expire_fragment_with_locale(name, options = nil) click to toggle source
    # File lib/locale_rails/action_controller/caching.rb, line 30
30:       def expire_fragment_with_locale(name, options = nil)
31:         return unless perform_caching
32: 
33:         fc_store = (respond_to? :cache_store) ? cache_store : fragment_cache_store
34:         key = name.is_a?(Regexp) ? name : fragment_cache_key_without_locale(name)
35:         if key.is_a?(Regexp)
36:           self.class.benchmark "Expired fragments matching: #{key.source}" do
37:             fc_store.delete_matched(key, options)
38:           end
39:         else
40:           key = key.gsub(/:/, ".")
41:           self.class.benchmark "Expired fragment: #{key}, lang = #{@@fragmented_locales}" do
42:             @@fragmented_locales.each do |lang|
43:               fc_store.delete("#{key}_#{lang}", options)
44:             end
45:           end
46:         end
47:       end
fragment_cache_key_with_locale(name) click to toggle source
    # File lib/locale_rails/action_controller/caching.rb, line 17
17:       def fragment_cache_key_with_locale(name) 
18:         ret = fragment_cache_key_without_locale(name)
19:         if ret.is_a? String
20:           unless @@fragmented_locales.include? I18n.locale
21:             @@fragmented_locales << I18n.locale
22:           end
23:           ret.gsub(/:/, ".") << "_#{I18n.locale}"
24:         else
25:           ret
26:         end
27:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.