From 93e97be8069c2410b7e32a026ef4adf098e72429 Mon Sep 17 00:00:00 2001 From: Thomas Ryan Date: Thu, 15 Aug 2024 09:40:24 -0700 Subject: [PATCH] Adjusted the caching. --- NumberSearch.Mvc/Controllers/CartAPIController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NumberSearch.Mvc/Controllers/CartAPIController.cs b/NumberSearch.Mvc/Controllers/CartAPIController.cs index fcd4303d..f05d4235 100644 --- a/NumberSearch.Mvc/Controllers/CartAPIController.cs +++ b/NumberSearch.Mvc/Controllers/CartAPIController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ViewFeatures; +using Microsoft.AspNetCore.OutputCaching; using NumberSearch.DataAccess; using NumberSearch.DataAccess.BulkVS; @@ -37,6 +38,8 @@ public CartAPIController(MvcConfiguration mvcConfiguration) public record BulkLookupResult(string DialedNumber, string City, string State, DateTime DateIngested, bool Wireless, bool Portable, DateTime LastPorted, string SPID, string LATA, string LEC, string LECType, string LIDBName, string LRN, string OCN, string CarrierName, string CarrierLogoLink); [HttpGet("Number/Search/Bulk")] + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + [OutputCache(Duration = 0)] public async Task NumberSearchBulkAsync(string token, string dialedNumber) { if (!string.IsNullOrWhiteSpace(token) && token == "Memorable8142024") @@ -51,11 +54,10 @@ public async Task NumberSearchBulkAsync(string token, string dial return BadRequest("No dialed phone numbers found. Please try a different query. πŸ₯ΊπŸ‘‰πŸ‘ˆ"); } - var lookup = new LookupController(_configuration); - var results = new List(); await Parallel.ForEachAsync(parsedNumbers, async (number, token) => { + var lookup = new LookupController(_configuration); var result = await lookup.VerifyPortabilityAsync(number); results.Add(result); });