Exemple #1
0
        public ETTask <ComponentWithId> Get(string collectionName, long id)
        {
            ETTaskCompletionSource <ComponentWithId> tcs = new ETTaskCompletionSource <ComponentWithId>();
            DBQueryTask dbQueryTask = ComponentFactory.CreateWithId <DBQueryTask, string, ETTaskCompletionSource <ComponentWithId> >(id, collectionName, tcs);

            this.tasks[(int)((ulong)id % taskCount)].Add(dbQueryTask);

            return(tcs.Task);
        }
Exemple #2
0
        public Task <ComponentWithId> Get(string collectionName, long id)
        {
            ComponentWithId component = GetFromCache(collectionName, id);

            if (component != null)
            {
                return(Task.FromResult(component));
            }

            TaskCompletionSource <ComponentWithId> tcs = new TaskCompletionSource <ComponentWithId>();
            DBQueryTask dbQueryTask = ComponentFactory.CreateWithId <DBQueryTask, string, TaskCompletionSource <ComponentWithId> >(id, collectionName, tcs);

            this.tasks[(int)((ulong)id % taskCount)].Add(dbQueryTask);

            return(tcs.Task);
        }
Exemple #3
0
 public override void Awake(DBQueryTask self, string collectionName, TaskCompletionSource <Component> tcs)
 {
     self.CollectionName = collectionName;
     self.Tcs            = tcs;
 }