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
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using API.Extensions;
|
||||
|
|
@ -5,6 +6,7 @@ using API.Middleware;
|
|||
using Hangfire;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.ResponseCompression;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
|
|
@ -55,6 +57,10 @@ namespace API
|
|||
options.Level = CompressionLevel.Fastest;
|
||||
});
|
||||
|
||||
services.AddResponseCaching();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +87,7 @@ namespace API
|
|||
app.UseCors(policy => policy.AllowAnyHeader().AllowAnyMethod().WithOrigins("http://localhost:4200"));
|
||||
}
|
||||
|
||||
//app.UseResponseCaching();
|
||||
app.UseResponseCaching();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
|
|
@ -94,6 +100,20 @@ namespace API
|
|||
ContentTypeProvider = new FileExtensionContentTypeProvider()
|
||||
});
|
||||
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
context.Response.GetTypedHeaders().CacheControl =
|
||||
new Microsoft.Net.Http.Headers.CacheControlHeaderValue()
|
||||
{
|
||||
Public = true,
|
||||
MaxAge = TimeSpan.FromSeconds(10)
|
||||
};
|
||||
// context.Response.Headers[Microsoft.Net.Http.Headers.HeaderNames.Vary] =
|
||||
// new string[] { "Accept-Encoding" };
|
||||
|
||||
await next();
|
||||
});
|
||||
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue