diff --git a/BotSharp.Core/AgentStorage/AgentStorageInMemory.cs b/BotSharp.Core/AgentStorage/AgentStorageInMemory.cs index a3671b45..068032e5 100644 --- a/BotSharp.Core/AgentStorage/AgentStorageInMemory.cs +++ b/BotSharp.Core/AgentStorage/AgentStorageInMemory.cs @@ -2,8 +2,7 @@ using BotSharp.Platform.Models; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using System.Threading.Tasks; namespace BotSharp.Core.AgentStorage diff --git a/BotSharp.Core/AgentStorage/AgentStorageInRedis.cs b/BotSharp.Core/AgentStorage/AgentStorageInRedis.cs index 7fb03532..d2364ecb 100644 --- a/BotSharp.Core/AgentStorage/AgentStorageInRedis.cs +++ b/BotSharp.Core/AgentStorage/AgentStorageInRedis.cs @@ -34,9 +34,9 @@ namespace BotSharp.Core.AgentStorage public async Task FetchById(string agentId) { var key = agentId; - if (csredis.Exists(key)) + if (await csredis.ExistsAsync(key)) { - return JsonConvert.DeserializeObject(csredis.Get(key)); + return JsonConvert.DeserializeObject(await csredis.GetAsync(key)); } else { @@ -51,7 +51,7 @@ namespace BotSharp.Core.AgentStorage var keys = csredis.Keys($"{prefix}*"); foreach (string key in keys) { - var data = csredis.Get(key.Substring(prefix.Length)); + var data = await csredis.GetAsync(key.Substring(prefix.Length)); var agent = JsonConvert.DeserializeObject(data); if(agent.Name == agentName) @@ -76,7 +76,7 @@ namespace BotSharp.Core.AgentStorage Formatting = Formatting.Indented, }); - csredis.Set(agent.Id, json); + await csredis.SetAsync(agent.Id, json); return true; } @@ -85,7 +85,7 @@ namespace BotSharp.Core.AgentStorage { var keys = csredis.Keys($"{prefix}*"); - csredis.Del(keys.Select(x => x.Substring(prefix.Length)).ToArray()); + await csredis.DelAsync(keys.Select(x => x.Substring(prefix.Length)).ToArray()); return keys.Count(); } @@ -97,7 +97,7 @@ namespace BotSharp.Core.AgentStorage var keys = csredis.Keys($"{prefix}*"); foreach (string key in keys) { - var data = csredis.Get(key.Substring(prefix.Length)); + var data = await csredis.GetAsync(key.Substring(prefix.Length)); var agent = JsonConvert.DeserializeObject(data); agents.Add(agent); }