C# Class Flatwhite.WebApi.OutputCacheAttribute

Inheritance: System.Web.Http.Filters.ActionFilterAttribute, ICacheSettings
ファイルを表示 Open project: vanthoainguyen/Flatwhite Class Usage Examples

Public Methods

Method Description
GetAllVaryCustomKey ( ) : string

Get all vary by custom string

OnActionExecutedAsync ( System.Web.Http.Filters.HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken ) : Task

Store the response to cache store, add CacheControl and Etag to response

OnActionExecutingAsync ( System.Web.Http.Controllers.HttpActionContext actionContext, CancellationToken cancellationToken ) : Task

Check CacheControl request, get CacheItem, build response and return if cache available

Protected Methods

Method Description
ApplyCacheHeaders ( HttpResponseMessage response, HttpRequestMessage request ) : void

Apply the CacheControl header to response

GetCacheResponseBuilder ( IDependencyScope scope ) : ICacheResponseBuilder

Get ICacheResponseBuilder from IDependencyScope

GetCacheStrategy ( IDependencyScope scope, _IInvocation invocation, object>.IDictionary invocationContext ) : ICacheStrategy

Get ICacheStrategy from IDependencyScope

GetInvocation ( System.Web.Http.Controllers.HttpActionContext actionContext ) : _IInvocation

Get _IInvocation from HttpActionContext

GetInvocationContext ( System.Web.Http.Controllers.HttpActionContext actionContext ) : object>.IDictionary

Get context data from HttpActionContext

HashCacheKey ( string originalCacheKey ) : string

Make a hash string of the original senstivive cacheKey

ShouldIgnoreCache ( CacheControlHeaderValue cacheControl, HttpRequestMessage request ) : bool

Determine whether or not should ignore all the cache settings base on the

Private Methods

Method Description
CreatePhoenix ( _IInvocation invocation, WebApiCacheItem cacheItem, HttpRequestMessage request ) : void

Create the phoenix object which can refresh the cache itself if StaleWhileRevalidate > 0

GetHashString ( byte content ) : string
RefreshCache ( string storedKey ) : void

Method Details

ApplyCacheHeaders() protected method

Apply the CacheControl header to response
protected ApplyCacheHeaders ( HttpResponseMessage response, HttpRequestMessage request ) : void
response System.Net.Http.HttpResponseMessage
request System.Net.Http.HttpRequestMessage
return void

GetAllVaryCustomKey() public method

Get all vary by custom string
public GetAllVaryCustomKey ( ) : string
return string

GetCacheResponseBuilder() protected method

Get ICacheResponseBuilder from IDependencyScope
protected GetCacheResponseBuilder ( IDependencyScope scope ) : ICacheResponseBuilder
scope IDependencyScope
return ICacheResponseBuilder

GetCacheStrategy() protected method

Get ICacheStrategy from IDependencyScope
protected GetCacheStrategy ( IDependencyScope scope, _IInvocation invocation, object>.IDictionary invocationContext ) : ICacheStrategy
scope IDependencyScope
invocation _IInvocation
invocationContext object>.IDictionary
return ICacheStrategy

GetInvocation() protected method

Get _IInvocation from HttpActionContext
protected GetInvocation ( System.Web.Http.Controllers.HttpActionContext actionContext ) : _IInvocation
actionContext System.Web.Http.Controllers.HttpActionContext
return _IInvocation

GetInvocationContext() protected method

Get context data from HttpActionContext
protected GetInvocationContext ( System.Web.Http.Controllers.HttpActionContext actionContext ) : object>.IDictionary
actionContext System.Web.Http.Controllers.HttpActionContext
return object>.IDictionary

HashCacheKey() protected method

Make a hash string of the original senstivive cacheKey
protected HashCacheKey ( string originalCacheKey ) : string
originalCacheKey string
return string

OnActionExecutedAsync() public method

Store the response to cache store, add CacheControl and Etag to response
public OnActionExecutedAsync ( System.Web.Http.Filters.HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken ) : Task
actionExecutedContext System.Web.Http.Filters.HttpActionExecutedContext
cancellationToken System.Threading.CancellationToken
return Task

OnActionExecutingAsync() public method

Check CacheControl request, get CacheItem, build response and return if cache available
public OnActionExecutingAsync ( System.Web.Http.Controllers.HttpActionContext actionContext, CancellationToken cancellationToken ) : Task
actionContext System.Web.Http.Controllers.HttpActionContext
cancellationToken System.Threading.CancellationToken
return Task

ShouldIgnoreCache() protected method

Determine whether or not should ignore all the cache settings base on the
protected ShouldIgnoreCache ( CacheControlHeaderValue cacheControl, HttpRequestMessage request ) : bool
cacheControl System.Net.Http.Headers.CacheControlHeaderValue
request System.Net.Http.HttpRequestMessage
return bool