Example #1
0
        public bool CompressAdd(string key, object value, int expireTime, string tbNames = "", string description = "")
        {
            if (value == null || string.IsNullOrWhiteSpace(key))
            {
                return(false);
            }
            AddKeyDic(key, tbNames, description, expireTime);
            byte[] compressData = CompressHelper.Compress(value);
            var    rst          = DistCache.Add(key, compressData, TimeSpan.FromMinutes(expireTime));

            return(rst);
        }
Example #2
0
        public T DecompressGet <T>(string key)
        {
            var decompressData = DistCache.Get <byte[]>(key);

            if (decompressData != null)
            {
                return(CompressHelper.Decompress <T>(decompressData));
            }
            //return default(T);
            else
            {
                return(default(T));
            }
        }