Class: BreezyPDF::Cache::InMemory
- Inherits:
-
Object
- Object
- BreezyPDF::Cache::InMemory
- Defined in:
- lib/breezy_pdf/cache/in_memory.rb
Overview
In Memory cache store for assets
Instance Method Summary collapse
- #fetch(key, opts = {}, &blk) ⇒ Object
-
#initialize ⇒ InMemory
constructor
A new instance of InMemory.
- #read(key) ⇒ Object
- #write(key, value, opts = {}) ⇒ Object
Constructor Details
#initialize ⇒ InMemory
Returns a new instance of InMemory.
6 7 8 9 |
# File 'lib/breezy_pdf/cache/in_memory.rb', line 6 def initialize @map = {} @monitor = Monitor.new end |
Instance Method Details
#fetch(key, opts = {}, &blk) ⇒ Object
23 24 25 26 27 |
# File 'lib/breezy_pdf/cache/in_memory.rb', line 23 def fetch(key, opts = {}, &blk) synchronize do fetch_value(key, opts, blk) end end |
#read(key) ⇒ Object
17 18 19 20 21 |
# File 'lib/breezy_pdf/cache/in_memory.rb', line 17 def read(key) synchronize do get_value(key) end end |
#write(key, value, opts = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/breezy_pdf/cache/in_memory.rb', line 11 def write(key, value, opts = {}) synchronize do write_value(key, value, opts) end end |