Exemplo n.º 1
0
        public static bool SetEntryInHash <T>(this DoRedisHash input, string hashid, string key, T entity) where T : class, new()
        {
            string item   = ConvertJson <T>(entity);
            bool   result = input.SetEntryInHash(hashid, key, item);

            return(result);
        }
Exemplo n.º 2
0
        public static List <T> GetHashValues <T>(this DoRedisHash input, string hashid) where T : class, new()
        {
            List <T>      list   = new List <T>();
            List <string> values = input.GetHashValues(hashid);

            foreach (string value in values)
            {
                T obj = StringToObject <T>(value);
                list.Add(obj);
            }
            return(list);
        }
Exemplo n.º 3
0
        public static T GetValueFromHash <T>(this DoRedisHash input, string hashid, string key) where T : class, new()
        {
            string item = input.GetValueFromHash(hashid, key);

            if (string.IsNullOrEmpty(item))
            {
                return(null);
            }
            T obj = StringToObject <T>(item);

            return(obj);
        }