예제 #1
0
        public Task <string> GetAsync(long key)
        {
            if (!this.lockSet.Contains(key))
            {
                this.locations.TryGetValue(key, out string location);
                return(Task.FromResult(location));
            }

            LocationQueryTask task = new LocationQueryTask(key);

            this.AddTask(key, task);
            return(task.Task);
        }
예제 #2
0
        public Task <int> GetAsync(long key)
        {
            if (!this.lockDict.ContainsKey(key))
            {
                this.locations.TryGetValue(key, out int location);
                //Log.Info($"location get key: {key} {location}");
                return(Task.FromResult(location));
            }

            LocationQueryTask task = new LocationQueryTask(key);

            this.AddTask(key, task);
            return(task.Task);
        }