C# Class Flatwhite.WebApi.OutputCacheAttribute

Inheritance: System.Web.Http.Filters.ActionFilterAttribute, ICacheSettings
Afficher le fichier Open project: vanthoainguyen/Flatwhite Class Usage Examples

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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

Méthode 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 méthode

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

GetAllVaryCustomKey() public méthode

Get all vary by custom string
public GetAllVaryCustomKey ( ) : string
Résultat string

GetCacheResponseBuilder() protected méthode

Get ICacheResponseBuilder from IDependencyScope
protected GetCacheResponseBuilder ( IDependencyScope scope ) : ICacheResponseBuilder
scope IDependencyScope
Résultat ICacheResponseBuilder

GetCacheStrategy() protected méthode

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

GetInvocation() protected méthode

Get _IInvocation from HttpActionContext
protected GetInvocation ( System.Web.Http.Controllers.HttpActionContext actionContext ) : _IInvocation
actionContext System.Web.Http.Controllers.HttpActionContext
Résultat _IInvocation

GetInvocationContext() protected méthode

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

HashCacheKey() protected méthode

Make a hash string of the original senstivive cacheKey
protected HashCacheKey ( string originalCacheKey ) : string
originalCacheKey string
Résultat string

OnActionExecutedAsync() public méthode

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
Résultat Task

OnActionExecutingAsync() public méthode

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
Résultat Task

ShouldIgnoreCache() protected méthode

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
Résultat bool