class Primer::Octicon::Cache

:nodoc:

def clear!

def clear!
  LOOKUP.clear
end

def get_key(symbol:, size:, width: nil, height: nil)

def get_key(symbol:, size:, width: nil, height: nil)
  attrs = { symbol: symbol, size: size, width: width, height: height }
  attrs.compact!
  attrs.hash
end

def limit

Cache size limit.
def limit
  500
end

def preload!

def preload!
  PRELOADED_ICONS.each { |icon| Primer::Beta::Octicon.new(icon: icon) }
end

def read(key)

def read(key)
  LOOKUP[key]
end

def set(key, value)

def set(key, value)
  LOOKUP[key] = value
  # Remove first item when the cache is too large.
  LOOKUP.shift if LOOKUP.size > limit
end