class Prawn::SynchronizedCache
@private
Public Class Methods
Source
# File lib/prawn/utilities.rb, line 21 def initialize @cache = {} @mutex = Mutex.new end
As an optimization, this could access the hash directly on VMs with a global interpreter lock (like MRI)
Public Instance Methods
Source
# File lib/prawn/utilities.rb, line 26 def [](key) @mutex.synchronize { @cache[key] } end
Source
# File lib/prawn/utilities.rb, line 30 def []=(key, value) @mutex.synchronize { @cache[key] = value } end