Example #1
0
        public async Task <RecordStorageTryGetResult <byte[]> > TryGetRequestBodyByIdAsync(string id)
        {
            var result = await _redis.StringGetAsync(GetRedisKey($"RecordEntry.RequestBody?{id}"));

            if (result.HasValue)
            {
                return(RecordStorageTryGetResult.Create(true, (byte[])result));
            }
            else
            {
                return(RecordStorageTryGetResult.Create(false, default(byte[])));
            }
        }
Example #2
0
 public Task <RecordStorageTryGetResult <byte[]> > TryGetResponseBodyByIdAsync(string id)
 {
     _lock.EnterReadLock();
     try
     {
         var succeed = _entries.TryGetValue(id, out var value);
         return(Task.FromResult(RecordStorageTryGetResult.Create(succeed, value?.ResponseBody)));
     }
     finally
     {
         _lock.ExitReadLock();
     }
 }
Example #3
0
        public async Task <RecordStorageTryGetResult <HttpRequestRecord> > TryGetDetailByIdAsync(string id)
        {
            var result = await _redis.StringGetAsync(GetRedisKey($"RecordEntry?{id}"));

            if (result.HasValue)
            {
                return(RecordStorageTryGetResult.Create(true, Deserialize <HttpRequestRecord>(result)));
            }
            else
            {
                return(RecordStorageTryGetResult.Create(false, default(HttpRequestRecord)));
            }
        }
Example #4
0
 public Task <RecordStorageTryGetResult <HttpRequestRecord> > TryGetDetailByIdAsync(string id)
 {
     _lock.EnterReadLock();
     try
     {
         var succeed = _entries.TryGetValue(id, out var value);
         return(Task.FromResult(RecordStorageTryGetResult.Create(succeed, value?.Record)));
     }
     finally
     {
         _lock.ExitReadLock();
     }
 }