예제 #1
0
 public void SetChunk(IChunk chunk)
 {
     Primary.SetChunk(chunk);
     foreach (IChunkStorage storage in Secondary)
     {
         Task.Run(() => storage.SetChunk(chunk));
     }
 }
예제 #2
0
        public IChunk GetChunk(string hash)
        {
            IChunk chunk = Primary.GetChunk(hash);

            if (chunk != null)
            {
                return(chunk);
            }
            foreach (IChunkStorage storage in Secondary)
            {
                chunk = storage.GetChunk(hash);
                if (chunk != null)
                {
                    Task.Run(() => Primary.SetChunk(chunk));
                    return(chunk);
                }
            }
            return(null);
        }