public async Task <HostWithoutRelation> GetHostByIdAsync(int hostId) { var db = _redisCache.GetDatabase(RedisDatabases.CacheData); HostWithoutRelation current = new HostWithoutRelation(); var data = await db.HashGetAsync("HostId", hostId); if (data.HasValue) { current = Newtonsoft.Json.JsonConvert.DeserializeObject <HostWithoutRelation>(data); } return(current); }
public async Task <HostWithoutRelation> GetHostAsync(string host) { host = host.ToLower(); var db = _redisCache.GetDatabase(RedisDatabases.CacheData); HostWithoutRelation current = new HostWithoutRelation(); var data = await db.HashGetAsync("Address", host); if (data.HasValue) { current = Newtonsoft.Json.JsonConvert.DeserializeObject <HostWithoutRelation>(data); } return(current); }