# File lib/rgen/util/file_cache_map.rb, line 35
  def load_data(key_path, options={})
    reasons = options[:invalidation_reasons] || []
    cf = cache_file(key_path)
    result = nil
    begin
      File.open(cf, "rb") do |f|
        header = f.read(41)
        if !header
          reasons << :cachefile_corrupted
          return :invalid
        end
        checksum = header[0..39]
        data = f.read
        if calc_sha1(data) == checksum
          if calc_sha1_keydata(key_path) == data[0..39]
            result = data[41..-1]
          else
            reasons << :keyfile_changed
            result = :invalid
          end
        else
          reasons << :cachefile_corrupted
          result = :invalid
        end
      end 
    rescue Errno::ENOENT
      reasons << :no_cachefile
      result = :invalid 
    end
    result
  end