void Flush (int index) { CachedBlock b = CachedBlocks[index]; CachedBlocks.RemoveAt (index); Interlocked.Add (ref cacheUsed, -b.Count); Write (b.File, b.Offset, b.Buffer, 0, b.Count, true); ClientEngine.BufferPool.Return (b.Buffer); }
void Flush(int index) { CachedBlock b = CachedBlocks[index]; CachedBlocks.RemoveAt(index); Interlocked.Add(ref cacheUsed, -b.Count); using (b.BufferReleaser) Write(b.File, b.Offset, b.Buffer, 0, b.Count, true); }
async ReusableTask FlushAsync(int index) { CachedBlock b = CachedBlocks[index]; CachedBlocks.RemoveAt(index); Interlocked.Add(ref cacheUsed, -b.Count); using (b.BufferReleaser) await WriteAsync(b.File, b.Offset, b.Buffer, 0, b.Count, true); }