You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: index_cache.rb
    path of file: ./repos/searchkick/lib/searchkick
    
    the code of the file until where you have to start completion: module Searchkick
  class IndexCache
    def initialize(max_size: 20)
      @data = {}
      @mutex = Mutex.new
      @max_size = max_size
    end

    # probab
    
    def fetch(name)
      # thread-safe in MRI without mutex
      # due to how context switching works
      @mutex.synchronize do
        if @data.key?(name)
          @data[name]
        else
          @data.clear if @data.size >= @max_size
          @data[name] = yield
        end
      end