From 0c688255ad21a94ab6569e8654892dca99ad77f1 Mon Sep 17 00:00:00 2001 From: chsami Date: Sat, 18 May 2024 20:45:08 +0200 Subject: [PATCH] Update SessionController.cs test controller added --- MicrobotApi/Controllers/SessionController.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MicrobotApi/Controllers/SessionController.cs b/MicrobotApi/Controllers/SessionController.cs index c90e626..ca8573b 100644 --- a/MicrobotApi/Controllers/SessionController.cs +++ b/MicrobotApi/Controllers/SessionController.cs @@ -12,12 +12,14 @@ public class SessionController : Controller { private readonly MicrobotContext _microbotContext; private readonly IMemoryCache _memoryCache; + private readonly IConfiguration _configuration; private readonly TimeSpan _cacheDuration = TimeSpan.FromMinutes(5); - public SessionController(MicrobotContext microbotContext, IMemoryCache memoryCache) + public SessionController(MicrobotContext microbotContext, IMemoryCache memoryCache, IConfiguration configuration) { _microbotContext = microbotContext; _memoryCache = memoryCache; + _configuration = configuration; } [HttpGet("")] @@ -75,6 +77,12 @@ public IActionResult CountLoggedIn() return Ok(GetCachedLoggedInCount()); } + [HttpGet("count/test")] + public IActionResult Tester() + { + return Ok(_configuration.GetConnectionString("MicrobotContext")); + } + private int GetCachedCount() { if (!_memoryCache.TryGetValue("CachedCount", out int cachedData))