示例#1
0
        public T Get <T>(string key)
        {
            var data = _RedisDb.HashGet(key, _dataConverter.Serialize(key));

            if (data.IsNull)
            {
                return(default(T));
            }
            else
            {
                return(_dataConverter.Deserialize <T>(data.ToString()));
            }
        }
示例#2
0
        public void Enqueue(T t)
        {
            byte[] data = dataConverter.Serialize(t);

            try
            {
                DataBlock dataBlock = DataBlock.CreateByUserData(data);

                lock (enqueueLock)
                {
                    fileManager.WriteQueueData(dataBlock.QueueData);
                }
            }
            catch (Exception e)
            {
                fileManager.WriteErrorQueueData(data, false);
                throw e;
            }
        }