In my previous post I have written about a Nuget package called Polly for Exception handling which you can find here.

In this post I will again write for a Nuget package which is called CourtesyFlush which was before known as PerfMatters.Flush and it is created by Nik

CourtesyFlush , as the name suggests it does the same effect in Coding word which simply means it is forcing a buffer to be moved along, usually to a file or the network. Rather than holding data, you flush it, and move it along.

Three Usage Patterns

The core of what you need to know to use PerfMatters.Flush is that I’ve tried to make it easy to use by providing a few different usage models. Pick the one that works best in your scenario, and feel free to mix and match across your application.

1. Attribute Based

The easiest way to use PerfMatters.Flush is via the [FlushHead] action filter attribute, like this:

As you can see, this mechanism allows for very dynamic <head> sections. In this example you could imagine a <title> element, <meta name="description" content="…"> attribute (for SEO purposes) and <link rel="dns-prefetch" href="…"> (for performance optimization) all being set.

3. Global Lambda

Finally, PerfMatters.Flush offers a model to flush early across all your application’s action methods – which simply leverages the same global action filters that have been in ASP.NET MVC for years now: