aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-11-16 06:15:19 +0100
committerivarlovlie <git@ivarlovlie.no>2022-11-16 06:15:19 +0100
commite2258afd01e86e0d46a03fa910412fa0827b2b5b (patch)
treeb70c2d13720610be4518918481ee01aad2ccefec
parenta7e7d83057503262a9f2b56c4fb0c18e3f8ea15c (diff)
downloadlettnytt-e2258afd01e86e0d46a03fa910412fa0827b2b5b.tar.xz
lettnytt-e2258afd01e86e0d46a03fa910412fa0827b2b5b.zip
fix: Correct injection of memory cache
-rw-r--r--src/Program.cs4
-rw-r--r--src/Services/GrabberService.cs4
2 files changed, 3 insertions, 5 deletions
diff --git a/src/Program.cs b/src/Program.cs
index d751102..0b7930a 100644
--- a/src/Program.cs
+++ b/src/Program.cs
@@ -1,18 +1,16 @@
global using I2R.LightNews.Services;
global using I2R.LightNews.Models;
global using IOL.Helpers;
-using System.Globalization;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpClient();
+builder.Services.AddMemoryCache();
builder.Services.AddScoped<GrabberService>();
builder.Services.AddRazorPages().AddRazorRuntimeCompilation();
var app = builder.Build();
-CultureInfo.CurrentCulture = new CultureInfo("nb-no");
-CultureInfo.CurrentUICulture = new CultureInfo("nb-no");
app.UseStaticFiles();
app.UseStatusCodePages();
app.UseRouting();
diff --git a/src/Services/GrabberService.cs b/src/Services/GrabberService.cs
index 4a92517..3974a9e 100644
--- a/src/Services/GrabberService.cs
+++ b/src/Services/GrabberService.cs
@@ -9,7 +9,7 @@ namespace I2R.LightNews.Services;
public class GrabberService
{
private readonly ILogger<GrabberService> _logger;
- private readonly MemoryCache _memoryCache;
+ private readonly IMemoryCache _memoryCache;
private readonly HttpClient _http;
private const string NrkPrefix = "nrkno";
private const int StaleTime = 1800;
@@ -18,7 +18,7 @@ public class GrabberService
HostPath = "AppData/__sitecache"
};
- public GrabberService(ILogger<GrabberService> logger, HttpClient http, MemoryCache memoryCache) {
+ public GrabberService(ILogger<GrabberService> logger, HttpClient http, IMemoryCache memoryCache) {
_logger = logger;
_http = http;
_memoryCache = memoryCache;