예제 #1
0
        public Task <Disposer> Get(string collectionName, long id)
        {
            Disposer entity = GetFromCache(collectionName, id);

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

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

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

            return(tcs.Task);
        }
예제 #2
0
        public Task <Component> Get(string collectionName, long id)
        {
            Component disposer = GetFromCache(collectionName, id);

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

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

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

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