Class: PuppetLibrary::Http::Cache::Disk
- Inherits:
-
Object
- Object
- PuppetLibrary::Http::Cache::Disk
- Defined in:
- lib/puppet_library/http/cache/disk.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #get(path = "entry") ⇒ Object
-
#initialize(directory) ⇒ Disk
constructor
A new instance of Disk.
Constructor Details
#initialize(directory) ⇒ Disk
Returns a new instance of Disk.
24 25 26 27 |
# File 'lib/puppet_library/http/cache/disk.rb', line 24 def initialize(directory) @directory = directory @mutex = Monitor.new end |
Instance Method Details
#clear ⇒ Object
37 38 39 40 41 |
# File 'lib/puppet_library/http/cache/disk.rb', line 37 def clear @mutex.synchronize do FileUtils.rm_rf @directory.path end end |
#get(path = "entry") ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/puppet_library/http/cache/disk.rb', line 29 def get(path = "entry") unless include? path buffer = yield save(path, buffer) end retrieve(path) end |