Class SimpleWritingChunkCache
A simple writing chunk cache which has not limits in size.
public class SimpleWritingChunkCache : IWritingChunkCache
- Inheritance
-
SimpleWritingChunkCache
- Implements
Constructors
SimpleWritingChunkCache()
public SimpleWritingChunkCache()
Methods
Flush(Action<ulong, Memory<byte>>?)
Flushes the chunk.
public void Flush(Action<ulong, Memory<byte>>? chunkWriter = null)
Parameters
chunkWriterAction<ulong, Memory<byte>>The chunk writer used for chunks being flushed from the cache.
GetChunk(ulong, Func<Memory<byte>>, Action<ulong, Memory<byte>>)
Tries to get the chunk at the given index.
public Memory<byte> GetChunk(ulong chunkIndex, Func<Memory<byte>> chunkAllocator, Action<ulong, Memory<byte>> chunkWriter)
Parameters
chunkIndexulongThe linear chunk index.
chunkAllocatorFunc<Memory<byte>>The chunk allocator is used whenever the chunk is not already cached.
chunkWriterAction<ulong, Memory<byte>>The chunk writer is used whenever the chunk is flushed from the cache.