protected int OnCacheHitLocked(ICompiler comp, DataHash hc, CacheManifest hm)
{
CopyStdio(comp, hc);
CopyOutputFiles(comp, hc);
// we dont need the lock now, it is highly unlikley someone else will
// modify these files
Unlock(CacheLockType.Read);
var duration = comp.Age;
var tstat = Task.Run(() =>
{
Stats.LockStatsCall(() =>
{
Stats.CacheHits++;
if (hm.Duration < duration.TotalMilliseconds)
{
// this cached result was slow. record a stat.
Stats.SlowHitCount++;
Logging.Emit("slow cache hit {0}ms", (int)duration.TotalMilliseconds);
}
else
{
Logging.Emit("fast cache hit {0}ms", (int)duration.TotalMilliseconds);
}
});
});
tstat.Wait();
return 0;
}