Skip to content

Request Keys

Request keys can in most ways be called a ‘Cache key’. Let’s say you want to cache an HTTP request, but that request has filters and varying types of parameters. Obviously, you want to have different caches for these varying parameters. Request keys gives you the ability to take control of HOW these keys are built right from your contract calls.

Request keys are currently used by the following middleware:

Let’s take a look at a sample request contract.

public record MyRequest(string Id, string Category) : IRequest<MyResult>, IRequestKey
{
// WARNING: we do not alter your key in anyway, so be sure to make it unique by adding things like the type
public string GetRequestKey() => $"MyRequest-{Id}-{Category}";
}
public record MyResult;