55 , _rootDir( rootDir_r )
65 if ( pi->mediaNr() == 0 )
67 if ( pi->repoInfo().baseUrlsEmpty() )
69 std::string scheme( pi->repoInfo().baseUrlsBegin()->getScheme() );
70 return ( scheme ==
"dvd" || scheme ==
"cd" );
114 addSize += pi->downloadSize();
119 if ( addToCache.empty() )
121 MIL <<
"could cache " <<
_lastInteractive <<
": " << addToCache.size() <<
" items: " << addSize << endl;
132 ERR <<
"Can not initialize cache dir " << pi << endl;
140 MIL <<
"available disk space in " <<
_cacheDir->path() <<
": " << df << endl;
142 if ( df / 10 < addSize )
144 WAR <<
"cache would require more than 10% of the available " << df <<
" disk space " << endl;
155 for ( CacheMap::iterator it = addToCache.begin(); it != addToCache.end(); ++it )
161 std::string destName(
str::form(
"S%p_%u_%s",
162 it->first->repository().id(),
163 it->first->mediaNr(),
164 fromSource.
value().basename().c_str() ) );
172 ERR <<
"Copy to cache failed on " << fromSource.
value() << endl;
177 it->second = fileInCache;
182 _cacheMap.insert( addToCache.begin(), addToCache.end() );
200 CacheMap::iterator it =
_cacheMap.find( citem_r );
210 PathInfo pi( cacheHit.
value() );
213 MIL <<
"Cache package provide " << cacheHit << endl;
217 WAR <<
"Cached file vanished: " << pi << endl;
233 <<
" to " << current << endl;