Module: CodeOwnership::Private::FilePathTeamCache

Extended by:
T::Helpers, T::Sig
Defined in:
lib/code_ownership/private/file_path_team_cache.rb

Class Method Summary collapse

Class Method Details

.bust_cache!Object



29
30
31
# File 'lib/code_ownership/private/file_path_team_cache.rb', line 29

def bust_cache!
  @cache = nil
end

.cacheObject



34
35
36
37
38
# File 'lib/code_ownership/private/file_path_team_cache.rb', line 34

def cache
  @cache ||= T.let(@cache,
    T.nilable(T::Hash[String, T.nilable(CodeTeams::Team)]))
  @cache ||= {}
end

.cached?(file_path) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/code_ownership/private/file_path_team_cache.rb', line 24

def cached?(file_path)
  cache.key?(file_path)
end

.get(file_path) ⇒ Object



14
15
16
# File 'lib/code_ownership/private/file_path_team_cache.rb', line 14

def get(file_path)
  cache[file_path]
end

.set(file_path, team) ⇒ Object



19
20
21
# File 'lib/code_ownership/private/file_path_team_cache.rb', line 19

def set(file_path, team)
  cache[file_path] = team
end