Skip to main content

CacheResponseAttribute

Cache the Response of a Service

Assembly: ServiceStack.dll
View Source
Declaration
public class CacheResponseAttribute : RequestFilterAsyncAttribute, _Attribute, IHasRequestFilterAsync, IRequestFilterBase

Properties

Duration

Cache expiry in seconds

View Source
Declaration
public int Duration { get; set; }

MaxAge

MaxAge in seconds

View Source
Declaration
public int MaxAge { get; set; }

CacheControl

Cache-Control HTTP Headers

View Source
Declaration
public CacheControl CacheControl { get; set; }

VaryByUser

Vary cache per user

View Source
Declaration
public bool VaryByUser { get; set; }

VaryByRoles

Vary cache for users in these roles

View Source
Declaration
public string[] VaryByRoles { get; set; }

VaryByHeaders

Vary cache for different HTTP Headers

View Source
Declaration
public string[] VaryByHeaders { get; set; }

LocalCache

Use HostContext.LocalCache or HostContext.Cache

View Source
Declaration
public bool LocalCache { get; set; }

NoCompression

Skip compression for this Cache Result

View Source
Declaration
public bool NoCompression { get; set; }

Inherited Properties

ApplyTo

View Source
Declaration
public ApplyTo ApplyTo { get; set; }

Priority

View Source
Declaration
public int Priority { get; set; }

Methods

ExecuteAsync(IRequest, IResponse, Object)

View Source
Declaration
public override async Task ExecuteAsync(IRequest req, IResponse res, object requestDto)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.ObjectrequestDto

Inherited Methods

Copy()

Create a ShallowCopy of this instance.

View Source
Declaration
public virtual IRequestFilterBase Copy()
Returns

ServiceStack.Web.IRequestFilterBase

ExecuteAsync(IRequest, IResponse, Object)

This method is only executed if the HTTP method matches the ServiceStack.RequestFilterAsyncAttribute.ApplyTo property.

View Source
Declaration
public abstract Task ExecuteAsync(IRequest req, IResponse res, object requestDto)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
ServiceStack.Web.IRequestreqThe http request wrapper

| | ServiceStack.Web.IResponse | res | The http response wrapper

| | System.Object | requestDto | The request DTO

|

RequestFilterAsync(IRequest, IResponse, Object)

View Source
Declaration
public Task RequestFilterAsync(IRequest req, IResponse res, object requestDto)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.Web.IRequestreq
ServiceStack.Web.IResponseres
System.ObjectrequestDto

Implements