public async Task GetAsync() { string key = "6"; var result = _redisDatabase.Set(key, "呼吁", TimeSpan.FromSeconds(60)); var value = await _redisDatabase.GetAsync <string>(key); Assert.AreEqual("呼吁", value); }
/// <summary> /// 查询一个key,不存在返回null /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <ResponseResult <XXXAo> > GetAsync(uint id) { var result = await _redisManager.GetAsync <XXXAo>($"RedisOption:Id{id}"); return(new ResponseResult <XXXAo> { Result = result, Code = 0, Msg = "查询成功" }); }
public async Task <Basket> GetBasketAsync(string customerId) { return(await _redisManager.GetAsync <Basket>(customerId)); }
/// <summary> /// 根据条件查询服务的实例 /// </summary> /// <param name="serviceName">服务的名称</param> /// <param name="serviceId">服务的Id</param> /// <returns>服务实例的实例列表,格式是(小写的服务实例Id,服务实例)</returns> public async Task <ServiceDescription> LookFor(string serviceName, string serviceId) { string key = GetKey(serviceName, serviceId); return(await _redisManager.GetAsync <ServiceDescription>(key).ConfigureAwait(false)); }