From 012158470f8bcba457aefa5cb6b55a4570c598f5 Mon Sep 17 00:00:00 2001 From: Haiping Chen <101423@smsassist.com> Date: Thu, 26 Oct 2023 09:18:14 -0500 Subject: [PATCH] PerInstanceCache = true --- .../Agents/Services/AgentService.GetAgents.cs | 8 ++------ .../BotSharp.Core/Repository/FileRepository.cs | 3 --- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.GetAgents.cs b/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.GetAgents.cs index 6b749b3b..5912b1e0 100644 --- a/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.GetAgents.cs +++ b/src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.GetAgents.cs @@ -4,18 +4,14 @@ namespace BotSharp.Core.Agents.Services; public partial class AgentService { -#if !DEBUG - [MemoryCache(10 * 60)] -#endif + [MemoryCache(10 * 60, PerInstanceCache = true)] public async Task> GetAgents(bool? allowRouting = null) { var agents = _db.GetAgents(allowRouting: allowRouting); return await Task.FromResult(agents); } -#if !DEBUG - [MemoryCache(10 * 60)] -#endif + [MemoryCache(10 * 60, PerInstanceCache = true)] public async Task GetAgent(string id) { var profile = _db.GetAgent(id); diff --git a/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs b/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs index a1779c34..8aed5989 100644 --- a/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs +++ b/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs @@ -486,9 +486,6 @@ public class FileRepository : IBotSharpRepository return responses; } -#if !DEBUG - [MemoryCache(10 * 60)] -#endif public Agent? GetAgent(string agentId) { var agentDir = Path.Combine(_dbSettings.FileRepository, _agentSettings.DataDir);