/// <summary> /// 用主鍵查詢 /// </summary> /// <param name="collectionName"></param> /// <param name="id"></param> /// <returns></returns> public ETTask <ComponentWithId> QueryById(string collectionName, long id, List <string> fields = null) { ETTaskCompletionSource <ComponentWithId> tcs = new ETTaskCompletionSource <ComponentWithId>(); CacheQueryByIdTask cacheQueryByIdTask = ComponentFactory.CreateWithId <CacheQueryByIdTask, string, List <string>, ETTaskCompletionSource <ComponentWithId> >(id, collectionName, fields, tcs); this.tasks[(int)((ulong)id % taskCount)].Add(cacheQueryByIdTask); return(tcs.Task); }
public override void Awake(CacheQueryByIdTask self, string collectionName, List <string> fields, ETTaskCompletionSource <ComponentWithId> tcs) { self.Tcs = tcs; self.CollectionName = collectionName; self.Fields = fields != null?fields.ToArray() : null; }