Ejemplo n.º 1
0
        public Task <List <VolumeModel> > GetVolume(string id)
        {
            var query = new GetVolumeById {
                Id = id
            };

            var result = new Task <List <VolumeModel> >(() => _Loader.Load(query));

            result.Start();

            return(result);
        }
Ejemplo n.º 2
0
        public List <VolumeModel> Load(GetVolumeById getVolumeById)
        {
            if (getVolumeById == null)
            {
                throw new ArgumentNullException("getVolumeById");
            }

            if (string.IsNullOrWhiteSpace(getVolumeById.Id))
            {
                throw new ArgumentException("Id is blank", "getVolumeById");
            }

            var cacheKey = string.Format("VOL_{0}_{1}", getVolumeById.Id, Thread.CurrentThread.CurrentUICulture.Name);

            var result = _cache.Retrieve(_ => LoadFromService(getVolumeById.Id), cacheKey, TimeSpan.FromMinutes(VolumeModelCacheMinutes));

            return(result ?? new List <VolumeModel>());
        }