Class: Nanoc::Github::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/github.rb

Instance Method Summary collapse

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, options = 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, options = 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, options = nil)
  store.transaction { store[name] = value }
end