Exemplo n.º 1
0
        public async Task <string> CompileAsync(string content, bool minify)
        {
            var hash = GetHash(new MD5CryptoServiceProvider(), content);

            var cacheContent = _cache.Get(hash) as string;

            if (cacheContent == null)
            {
                cacheContent = await _compiler.CompileAsync(content, minify);

                _cache.Set(hash, cacheContent, new CacheItemPolicy
                {
                    Priority           = CacheItemPriority.NotRemovable,
                    AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(5)
                });
            }

            return(cacheContent);
        }