Get() public method

public Get ( ByteBuffer key ) : Task
key ByteBuffer
return Task
Esempio n. 1
0
 public void GetFromEmptyCacheReturnsEmptyByteBuffer()
 {
     using (var fileCollection = new InMemoryFileCollection())
     using (var cache = new DiskChunkCache(fileCollection, 20, 1000))
     {
         Assert.AreEqual(0, cache.Get(CalcHash(new byte[] { 0 })).Result.Length);
     }
 }
Esempio n. 2
0
 public void WhatIPutICanGet()
 {
     using (var fileCollection = new InMemoryFileCollection())
     using (var cache = new DiskChunkCache(fileCollection, 20, 1000))
     {
         cache.Put(CalcHash(new byte[] { 0 }), ByteBuffer.NewAsync(new byte[] { 1 }));
         Assert.AreEqual(new byte[] { 1 }, cache.Get(CalcHash(new byte[] { 0 })).Result.ToByteArray());
     }
 }
Esempio n. 3
0
 public void ItRemebersContentAfterReopen()
 {
     using (var fileCollection = new InMemoryFileCollection())
     {
         using (var cache = new DiskChunkCache(fileCollection, 20, 1000))
         {
             cache.Put(CalcHash(new byte[] { 0 }), ByteBuffer.NewAsync(new byte[] { 1 }));
         }
         using (var cache = new DiskChunkCache(fileCollection, 20, 1000))
         {
             Assert.AreEqual(new byte[] { 1 }, cache.Get(CalcHash(new byte[] { 0 })).Result.ToByteArray());
         }
     }
 }