Improved the speed of regular expression expirations for caching by a factor...

Improved the speed of regular expression expirations for caching by a factor of 10 #1221 [Jamis Buck]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1248 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 be27caf9
*SVN*
* Improved the speed of regular expression expirations for caching by a factor of 10 #1221 [Jamis Buck]
* Removed dumping of template assigns on the rescue page as it would very easily include a ton of data making page loads take seconds (and the information was rarely helpful) #1222
* Added BenchmarkHelper that can measure the execution time of a block in a template and reports the result to the log. Example:
......
......@@ -368,8 +368,8 @@ def delete(name, options) #:nodoc:
end
def delete_matched(matcher, options) #:nodoc:
search_dir(@cache_path).each do |f|
File.delete(f) if f =~ matcher && File.exist?(f)
search_dir(@cache_path) do |f|
File.delete(f) rescue nil if f =~ matcher
end
end
......@@ -382,19 +382,16 @@ def ensure_cache_path(path)
FileUtils.makedirs(path) unless File.exists?(path)
end
def search_dir(dir)
require 'pathname'
files = []
dir = Dir.new(dir)
dir.each do |d|
unless d == '.' or d == '..'
d = File.join(dir.path, d)
p = Pathname.new(d)
files << p.to_s if p.file?
files += search_dir(d) if p.directory?
def search_dir(dir, &callback)
Dir.foreach(dir) do |d|
next if d == "." || d == ".."
name = File.join(dir, d)
if File.directory?(name)
search_dir(name, &callback)
else
callback.call name
end
end
files
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册