Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hallatore/mvcoptimizations

Performance utilities for MVC4 applications
https://github.com/hallatore/mvcoptimizations

Last synced: 19 days ago
JSON representation

Performance utilities for MVC4 applications

Awesome Lists containing this project

README

        

Author: Tore Lervik - http://mindre.net

Download: https://nuget.org/packages/MvcOptimizations or ```PM> Install-Package MvcOptimizations```

# Documentation

## HtmlMinifierAttribute

Minifies the html-output to remove whitespace. Usually removes 15-20% of the content on MVC pages and only has about 1ms overhead. The filter will only trigger when the content type is text/html.

```csharp
[HtmlMinifier]
public ActionResult Index() { ... }

// or

filters.Add(new HtmlMinifierAttribute());
```

## CompressFilterAttribute

Used on JsonResult because Mvc doesn't gzip Json-output. Can also be used on other actions that doesn't compress by default.

```csharp
[CompressFilter]
public JsonResult Articles() { ... }
```

## Utilities.Cache

Helper method for easier object caching.

```csharp
var articles = MvcOptimizations.Utilities.Cache("Articles", TimeSpan.FromMinutes(10), () =>
{
var result = Service.GetArticles();
SortArticles(result);
return result;
});
```