Exemple #1
0
        internal ValueTask <IMemoryOwner <byte> > GetBlockAsync(int blockId)
        {
            if (blockId >= _blockCount)
            {
                throw new ArgumentOutOfRangeException($"You requested a block of {blockId} but the block count is only {_blockCount}");
            }

            Interlocked.Increment(ref _numberOfRefs);
            var mem = new MMapBlockCacheMemory(_parentCache, _fileId, blockId, _ptr);

            return(new ValueTask <IMemoryOwner <byte> >(mem));
        }
Exemple #2
0
 internal void ReturnBlock(MMapBlockCacheMemory blockCacheMemory)
 {
     _cache[blockCacheMemory.FileId].MemoryReturned();
 }