class Roda::RodaCache

each protected by a mutex.
A thread safe cache class, offering only #[] and #[]= methods,

def [](key)

Make getting value from underlying hash thread safe.
def [](key)
  @mutex.synchronize{@hash[key]}
end

def []=(key, value)

Make setting value in underlying hash thread safe.
def []=(key, value)
  @mutex.synchronize{@hash[key] = value}
end

def freeze

thread safety issues.
be accessed directly since it is frozen and there are no
Return the frozen internal hash. The internal hash can then
def freeze
  @hash.freeze
end

def initialize

Create a new thread safe cache.
def initialize
  @mutex = Mutex.new
  @hash = {}
end

def initialize_copy(other)

Create a copy of the cache with a separate mutex.
def initialize_copy(other)
  @mutex = Mutex.new
  other.instance_variable_get(:@mutex).synchronize do
    @hash = other.instance_variable_get(:@hash).dup
  end
end