Exemplo n.º 1
0
        public List <T> GetValuesByIds <T>(List <string> ids, bool needKeyFormat = false)
        {
            using (var Redis = RedisClientManager.GetReadOnlyClient())
            {
                List <T> results = new List <T>();
                if (needKeyFormat)
                {
                    for (int i = 0; i < ids.Count; i++)
                    {
                        ids[i] = RedisKeyFactory.ModelKey <T>(ids[i]);
                    }
                    results = Redis.GetValues <T>(ids);
                }
                else
                {
                    results = Redis.GetValues <T>(ids);
                }

                return(results == null ? new List <T>() : results);
            }
        }
Exemplo n.º 2
0
 private string GetKey <T>(string id)
 {
     return(RedisKeyFactory.ModelKey <T>(id));
 }
Exemplo n.º 3
0
 protected string GetKey <T>(T model) where T : IRedisModelBase
 {
     return(RedisKeyFactory.ModelKey <T>(model.Id));
 }