Class: Nanoc::Github::Cache
- Inherits:
-
Object
- Object
- Nanoc::Github::Cache
- Defined in:
- lib/nanoc/github.rb
Instance Method Summary collapse
- #delete(name, options = nil) ⇒ Object
-
#initialize(cache_dir) ⇒ Cache
constructor
A new instance of Cache.
- #read(name, options = nil) ⇒ Object
- #write(name, value, options = nil) ⇒ Object
Constructor Details
#initialize(cache_dir) ⇒ Cache
Returns a new instance of Cache.
13 14 15 |
# File 'lib/nanoc/github.rb', line 13 def initialize(cache_dir) @store = PStore.new(File.join(cache_dir, "nanoc-github.store"), true) end |
Instance Method Details
#delete(name, options = nil) ⇒ Object
25 26 27 |
# File 'lib/nanoc/github.rb', line 25 def delete(name, = nil) store.transaction { store.delete(name) } end |
#read(name, options = nil) ⇒ Object
21 22 23 |
# File 'lib/nanoc/github.rb', line 21 def read(name, = nil) store.transaction(true) { store[name] } end |
#write(name, value, options = nil) ⇒ Object
17 18 19 |
# File 'lib/nanoc/github.rb', line 17 def write(name, value, = nil) store.transaction { store[name] = value } end |