Class: Necropsy::Cache::ScanCache
- Inherits:
-
Object
- Object
- Necropsy::Cache::ScanCache
- Defined in:
- lib/necropsy/cache/scan_cache.rb
Constant Summary collapse
- VERSION =
3
Instance Method Summary collapse
- #fetch(files) ⇒ Object
-
#initialize(project:) ⇒ ScanCache
constructor
A new instance of ScanCache.
Constructor Details
#initialize(project:) ⇒ ScanCache
Returns a new instance of ScanCache.
11 12 13 |
# File 'lib/necropsy/cache/scan_cache.rb', line 11 def initialize(project:) @project = project end |
Instance Method Details
#fetch(files) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/necropsy/cache/scan_cache.rb', line 15 def fetch(files) return yield unless project.config.cache_enabled? = (files) cached = read() return cached if cached result = yield write(, result) result rescue SystemCallError, Psych::Exception yield end |