mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
be27caf92d
commit
5640f76970
2 changed files with 12 additions and 13 deletions
|
@ -1,5 +1,7 @@
|
|||
*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 @@ module ActionController #: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 @@ module ActionController #:nodoc:
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue