Prevent OutputCache from caching for changes in one parameter, allow for others
<p>I'm implementing output caching in my solution and found an issue for covering this specific scenario.</p>

<p>There's a search action that has a few parameters, the first one is the searched text and the rest are filters, sort, offset and limit. It looks somewhat like this:</p>

<pre><code>public async Task&lt;ActionResult&gt; Search(
    string query = "",
    ushort limit = 12,
    int offset = 0,
    int filter1 = 0,
    int filter2 = 0,           
    SortObject sort = null)
{
}
</code></pre>

<p>The thing is, the filtered search without a query is used most often and I want to cache the results of that kind. However, if someone uses a text query, it will most probably be a unique one every time, so I don't see a point in caching those and wasting memory space.</p>

<p>I've used the following <code>OutputCacheAttribute</code> to achieve that:</p>

<pre><code>[OutputCache(Duration = 3600, VaryByParam = "filter1;filter2;limit;offset;sort")]
</code></pre>

<p>But (as expected) it didn't work, as it completely ignores the <code>query</code> parameter and caches per change in other parameters.</p>

<p>What I want to achieve is to cache the results for <code>query</code> parameter being empty, while others are being changed. However, if the <code>query</code> parameter is not empty, I want the request to go always go to the code.</p>

<p>Is that possible to achieve with Output Cache?</p>