Class CacheDefinition

Namespace: redb.Route.Cache
Assembly: redb.Route.Cache.dll

The caching scope (WSO2 Cache mediator analog): on a hit the body (and optionally the headers)
comes from the cache and the inner steps are skipped; on a miss they run and the result is stored.
Header cache.hit says which. Close with .

public sealed class CacheDefinition : RouteDefinitionBase<CacheDefinition>, IRouteDefinition, IProcessorDefinition, IRouteScope

Inheritance

Implements

Inherited Members

Methods

CacheHeaders(bool)

Store and restore the headers together with the body.

public CacheDefinition CacheHeaders(bool value = true)

CreateProcessor(IRouteContext)

Compile this node into a runtime processor.

public override IProcessor CreateProcessor(IRouteContext context)

Distributed()

Use the IDistributedCache registered in DI or on the context.

public CacheDefinition Distributed()

End()

Closes this scope and returns the parent .

public IRouteDefinition End()

EndCache()

Closes the scope and returns to the enclosing route.

public IRouteDefinition EndCache()

InMemory()

Use the in-process cache (default).

public CacheDefinition InMemory()

KeyFromBody()

Key = SHA-256 of the body instead of the explicit key (WSO2 "hash of the request" mode). Only the

public CacheDefinition KeyFromBody()

Region(string)

Key namespace; clear on the component empties one region. Default default.

public CacheDefinition Region(string region)

SlidingExpiration(TimeSpan)

Lifetime renewed on every hit.

public CacheDefinition SlidingExpiration(TimeSpan sliding)

Ttl(TimeSpan)

Absolute lifetime of an entry.

public CacheDefinition Ttl(TimeSpan ttl)