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:
parent
24118da49c
commit
1f24725905
10 changed files with 792 additions and 18 deletions
|
@ -24,17 +24,20 @@ namespace API.Extensions
|
|||
/// Calculates SHA1 hash for a byte[] and sets as ETag. Ensures Cache-Control: private header is added.
|
||||
/// </summary>
|
||||
/// <param name="response"></param>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="content">If byte[] is null or empty, will only add cache-control</param>
|
||||
public static void AddCacheHeader(this HttpResponse response, byte[] content)
|
||||
{
|
||||
// Calculates SHA1 Hash for byte[]
|
||||
if (content != null && content.Length > 0)
|
||||
{
|
||||
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");
|
||||
if (content == null || content.Length <= 0) return;
|
||||
using var sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();
|
||||
response.Headers.Add("ETag", string.Concat(sha1.ComputeHash(content).Select(x => x.ToString("X2"))));
|
||||
|
||||
// Not Needed with Response Caching
|
||||
// if (!response.Headers.Keys.Contains("Cache-Control"))
|
||||
// {
|
||||
// response.Headers.Add("Cache-Control", "private");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue