Added indexes to Series table for searching. Removed byte[] from SearchResultDTO. Added response caching for all APIs. Responses are cached for 10 seconds.

This commit is contained in:
Joseph Milazzo 2021-03-12 18:21:13 -06:00
parent 24118da49c
commit 1f24725905
10 changed files with 792 additions and 18 deletions

View file

@ -40,12 +40,9 @@ namespace API.Controllers
var content = await _directoryService.ReadFileAsync(path);
var format = Path.GetExtension(path).Replace(".", "");
// Look into HttpContext.Cache so we can utilize a memorystream for Zip entries (want to limit response time by 300ms)
// Calculates SHA1 Hash for byte[]
using var sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();
Response.Headers.Add("ETag", string.Concat(sha1.ComputeHash(content).Select(x => x.ToString("X2"))));
Response.Headers.Add("Cache-Control", "private");
Response.AddCacheHeader(content);
return File(content, "image/" + format);
}