Sha256: 298830a18aa56bccdbfa6a98ceee3fc891fa06d5bdab0483e10cbf0f422ae609
Contents?: true
Size: 1016 Bytes
Versions: 56
Compression:
Stored size: 1016 Bytes
Contents
# frozen_string_literal: true module Avm module Launcher module Instances module Base module Cache def cache_path(subpath) File.join(cache_root, subpath) end def cache_key(key, &block) v = cache_key_get(key) return v if v.present? || block.nil? v = yield cache_key_write(key, v) v end private def cache_key_get(key) File.file?(cache_key_path(key)) ? File.read(cache_key_path(key)) : nil end def cache_key_write(key, value) FileUtils.mkdir_p(File.dirname(cache_key_path(key))) File.write(cache_key_path(key), value) end def cache_key_path(key) File.join(cache_root, 'keys', key.parameterize) end def cache_root File.join(::EacLauncher::Context.current.cache_root, name.parameterize) end end end end end end
Version data entries
56 entries across 56 versions & 1 rubygems