Flatwhite.WebApi.OutputCacheAttribute.CreatePhoenix C# (CSharp) Method

CreatePhoenix() private method

Create the phoenix object which can refresh the cache itself if StaleWhileRevalidate > 0
private CreatePhoenix ( _IInvocation invocation, WebApiCacheItem cacheItem, HttpRequestMessage request ) : void
invocation _IInvocation
cacheItem WebApiCacheItem
request System.Net.Http.HttpRequestMessage
return void
        private void CreatePhoenix(_IInvocation invocation, WebApiCacheItem cacheItem, HttpRequestMessage request)
        {
            if (cacheItem.StaleWhileRevalidate <= 0 || request.Method != HttpMethod.Get)
            {
                return;
            }

            Phoenix phoenix;
            if (Global.Cache.PhoenixFireCage.TryGetValue(cacheItem.Key, out phoenix))
            {
                phoenix?.Dispose();
            }

            Global.Cache.PhoenixFireCage[cacheItem.Key] = new WebApiPhoenix(invocation, cacheItem, request);
        }