Module: Cachable Private

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Instance Method Summary collapse

Instance Method Details

#cacheHash{T.untyped => T.untyped}

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Hash{T.untyped => T.untyped})


6
7
8
# File 'extend/cachable.rb', line 6

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

#clear_cachevoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Note:

We overwrite here instead of using Hash#clear to handle frozen hashes.

This method returns an undefined value.



12
13
14
# File 'extend/cachable.rb', line 12

def clear_cache
  overwrite_cache!({})
end