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