Ejemplo n.º 1
0
        public async Task <T> Please()
        {
            T   cachedResult;
            var foundInCache = _responseCache.TryGet(_requestData, out cachedResult);

            if (foundInCache)
            {
                return(cachedResult);
            }

            Response response = await Response();

            var result = _parser.Parse <T>(response);

            // set to cache only after all validation and parsing has succeeded
            _responseCache.Set(_requestData, result);

            return(result);
        }