Skip to content

Instantly share code, notes, and snippets.

@rodolfofadino
Last active October 22, 2018 22:12
Show Gist options
  • Save rodolfofadino/a2db67c67c7fb998f550ebbb9dcdec2e to your computer and use it in GitHub Desktop.
Save rodolfofadino/a2db67c67c7fb998f550ebbb9dcdec2e to your computer and use it in GitHub Desktop.

Aula 5

passo 1

   https://www.microsoft.com/net/download/thank-you/dotnet-sdk-2.1.403-windows-x64-installer

Bindler Minifier

https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier

Image Sprites

https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ImageSprites

RIOT

http://luci.criosweb.ro/riot/

memory cache

 services.AddMemoryCache();

memory cache

 Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache

memory cache

 var cacheEntryOptions = new MemoryCacheEntryOptions()
    .SetAbsoluteExpiration(DateTime.Now.AddMinutes(2));

_memoryCache.Set(cacheKey, retorno, cacheEntryOptions);

response compression

app.UseResponseCompression();

response compression

services.Configure<GzipCompressionProviderOptions>(
  o => o.Level = System.IO.Compression.CompressionLevel.Fastest);

services.AddResponseCompression(o =>
{
    o.Providers.Add<GzipCompressionProvider>();
});

static files

app.UseStaticFiles(new StaticFileOptions
{
    OnPrepareResponse = ctx =>
    {
        const int durationInSeconds = 60 * 60 * 24;
        ctx.Context.Response.Headers[HeaderNames.CacheControl] =
            "public,max-age=" + durationInSeconds;
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment