mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge commit 'rails/3-0-unstable'
This commit is contained in:
@@ -3,7 +3,6 @@ require 'stringio'
|
||||
require 'strscan'
|
||||
|
||||
require 'active_support/memoizable'
|
||||
require 'action_controller/cgi_ext'
|
||||
|
||||
module ActionDispatch
|
||||
class Request < Rack::Request
|
||||
|
||||
@@ -1,29 +1,4 @@
|
||||
module ActiveSupport
|
||||
class ConcurrentHash
|
||||
def initialize(hash = {})
|
||||
@backup_cache = hash.dup
|
||||
@frozen_cache = hash.dup.freeze
|
||||
@mutex = Mutex.new
|
||||
end
|
||||
|
||||
def []=(k,v)
|
||||
@mutex.synchronize { @backup_cache[k] = v }
|
||||
@frozen_cache = @backup_cache.dup.freeze
|
||||
end
|
||||
|
||||
def [](k)
|
||||
if @frozen_cache.key?(k)
|
||||
@frozen_cache[k]
|
||||
else
|
||||
@mutex.synchronize { @backup_cache[k] }
|
||||
end
|
||||
end
|
||||
|
||||
def empty?
|
||||
@backup_cache.empty?
|
||||
end
|
||||
end
|
||||
|
||||
module SafelyMemoizable
|
||||
def safely_memoize(*symbols)
|
||||
symbols.each do |symbol|
|
||||
|
||||
Reference in New Issue
Block a user