def cache_data
return @cache_data if @cache_data
@dirty = false
cache_file
begin
data = File.open cache_file, 'rb' do |fp| fp.read end
@cache_data = Marshal.load data
@cache_data.each do |url, sice|
next unless Hash === sice
@dirty = true
if sice.key? 'cache' and sice.key? 'size' and
Gem::SourceIndex === sice['cache'] and Numeric === sice['size'] then
new_sice = Gem::SourceInfoCacheEntry.new sice['cache'], sice['size']
@cache_data[url] = new_sice
else
sice = Gem::SourceInfoCacheEntry.new Gem::SourceIndex.new, 0
sice.refresh url
@cache_data[url] = sice
end
end
@cache_data
rescue
{}
end
end