Esempio n. 1
0
        public ShortUrl GetByPath(string path)
        {
            _loggerservice.LogInformation("GetByPath request called : " + path);
            ShortUrl shorturl = null;

            _shortUrlCacheService.TryGetValue(path, out shorturl);
            if (shorturl == null)
            {
                _loggerservice.LogInformation("shorturl is not in cache service, getting from repo : " + path);
                shorturl = _mapper.Map <ShortUrl>(_shortUrlRepository.GetByPath(path));
                if (shorturl != null)
                {
                    _shortUrlCacheService.Set(path, shorturl);
                    _loggerservice.LogInformation("shorturl successfully cached : " + path);
                }
            }
            else
            {
                _loggerservice.LogInformation("shorturl get from cache : " + path);
            }
            return(shorturl);
        }