Class: Gitlab::Ci::Build::Cache

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/build/cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(cache, pipeline) ⇒ Cache

Returns a new instance of Cache.



9
10
11
12
13
14
15
16
17
# File 'lib/gitlab/ci/build/cache.rb', line 9

def initialize(cache, pipeline)
  cache = Array.wrap(cache)
  @cache = cache.map.with_index do |cache, index|
    prefix = cache_prefix(cache, index)

    Gitlab::Ci::Pipeline::Seed::Build::Cache
    .new(pipeline, cache, prefix)
  end
end

Instance Method Details

#cache_attributesObject



19
20
21
22
23
24
25
26
27
# File 'lib/gitlab/ci/build/cache.rb', line 19

def cache_attributes
  strong_memoize(:cache_attributes) do
    if @cache.empty?
      {}
    else
      { options: { cache: @cache.map(&:attributes) } }
    end
  end
end