/// <summary> /// Send to queue pool /// </summary> /// <param name="entityList"></param> public static void Send(AbstractEntity[] entityList) { string key = ""; try { if (entityList == null || entityList.Length == 0) return; var groupList = entityList.GroupBy(t => t.GetIdentityId()); foreach (var g in groupList) { var valueList = g.ToList(); byte[][] keyBytes = new byte[valueList.Count][]; byte[][] valueBytes = new byte[valueList.Count][]; string queueKey = GetRedisSyncQueueKey(g.Key); byte[] idBytes = BufferUtils.GetBytes(g.Key); int index = 0; foreach (var entity in valueList) { key = string.Format("{0}_{1}", entity.GetType().FullName, entity.GetKeyCode()); keyBytes[index] = RedisConnectionPool.ToByteKey(key); byte[] stateBytes = BufferUtils.GetBytes(entity.IsDelete ? 1 : 0); valueBytes[index] = BufferUtils.MergeBytes( BufferUtils.GetBytes(idBytes.Length + stateBytes.Length), idBytes, stateBytes, ProtoBufUtils.Serialize(entity)); index++; } RedisConnectionPool.Process(client => client.HMSet(queueKey, keyBytes, valueBytes)); } } catch (Exception ex) { TraceLog.WriteError("Post changed key:{0} error:{1}", key, ex); } }