Module: Namespaces::Traversal::Cached

Extended by:
ActiveSupport::Concern, Gitlab::Utils::Override
Included in:
Namespace
Defined in:
app/models/namespaces/traversal/cached.rb

Instance Method Summary collapse

Methods included from Gitlab::Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Instance Method Details

#all_project_idsObject



28
29
30
31
32
33
34
35
36
# File 'app/models/namespaces/traversal/cached.rb', line 28

def all_project_ids
  return super unless attempt_to_use_cached_data?

  scope_with_cached_ids(
    all_projects.select(:id),
    Project,
    Namespaces::Descendants.arel_table[:all_project_ids]
  )
end

#self_and_descendant_ids(skope: self.class) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/namespaces/traversal/cached.rb', line 14

def self_and_descendant_ids(skope: self.class)
  # Cache only works for descendants
  # of the same type as the caller.
  return super unless skope == self.class
  return super unless attempt_to_use_cached_data?

  scope_with_cached_ids(
    super,
    skope,
    Namespaces::Descendants.arel_table[:self_and_descendant_group_ids]
  )
end