mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Tweaks and tinkering
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@390 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
efdabfb8f5
commit
2182a8203f
1 changed files with 10 additions and 5 deletions
|
@ -120,7 +120,13 @@ module ActionController #:nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
def expire_action(options = {})
|
def expire_action(options = {})
|
||||||
expire_fragment(url_for(options).split("://").last)
|
if options[:action].is_a?(Array)
|
||||||
|
options[:action].dup.each do |action|
|
||||||
|
expire_fragment(url_for(options.merge({ :action => action })).split("://").last)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
expire_fragment(url_for(options).split("://").last)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ActionCacheFilter #:nodoc:
|
class ActionCacheFilter #:nodoc:
|
||||||
|
@ -182,7 +188,6 @@ module ActionController #:nodoc:
|
||||||
def cache_erb_fragment(binding, name = {}, options = {})
|
def cache_erb_fragment(binding, name = {}, options = {})
|
||||||
buffer = eval("_erbout", binding)
|
buffer = eval("_erbout", binding)
|
||||||
|
|
||||||
name = url_for(name) if name.is_a?(Hash)
|
|
||||||
if cache = read_fragment(name, options)
|
if cache = read_fragment(name, options)
|
||||||
buffer.concat(cache)
|
buffer.concat(cache)
|
||||||
else
|
else
|
||||||
|
@ -193,14 +198,14 @@ module ActionController #:nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_fragment(name, content, options = {})
|
def write_fragment(name, content, options = {})
|
||||||
name = url_for(name) if name.is_a?(Hash)
|
name = url_for(name).split("://").last if name.is_a?(Hash)
|
||||||
fragment_cache_store.write(name, content, options)
|
fragment_cache_store.write(name, content, options)
|
||||||
logger.info "Cached fragment: #{name}" unless logger.nil?
|
logger.info "Cached fragment: #{name}" unless logger.nil?
|
||||||
content
|
content
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_fragment(name, options = {})
|
def read_fragment(name, options = {})
|
||||||
name = url_for(name) if name.is_a?(Hash)
|
name = url_for(name).split("://").last if name.is_a?(Hash)
|
||||||
if cache = fragment_cache_store.read(name, options)
|
if cache = fragment_cache_store.read(name, options)
|
||||||
logger.info "Fragment hit: #{name}" unless logger.nil?
|
logger.info "Fragment hit: #{name}" unless logger.nil?
|
||||||
cache
|
cache
|
||||||
|
@ -210,7 +215,7 @@ module ActionController #:nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
def expire_fragment(name, options = {})
|
def expire_fragment(name, options = {})
|
||||||
name = url_for(name) if name.is_a?(Hash)
|
name = url_for(name).split("://").last if name.is_a?(Hash)
|
||||||
fragment_cache_store.delete(name, options)
|
fragment_cache_store.delete(name, options)
|
||||||
logger.info "Expired fragment: #{name}" unless logger.nil?
|
logger.info "Expired fragment: #{name}" unless logger.nil?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue