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

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(cache, pipeline) ⇒ Cache

Returns a new instance of Cache.


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

def initialize(cache, pipeline)
  cache = Array.wrap(cache)
  @cache = cache.map do |cache|
    Gitlab::Ci::Pipeline::Seed::Build::Cache
    .new(pipeline, cache)
  end
end

Instance Method Details

#cache_attributesObject


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

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