# HttpRequestCacheConfigurationProperty

The optional response-caching configuration shared by the HTTP-based function types (HTTP_REQUEST, AWS_SERVICE_REQUEST, and VAST_REQUEST).

When you provide this configuration, MediaTailor caches function responses with HTTP status codes 200, 203, 204, 404, 405, 410, 414, or 501. For a cacheable response, MediaTailor uses the Cache-Control max-age directive limited to the range between TtlMinimumSeconds and TtlMaximumSeconds. If no max-age directive is present, MediaTailor uses TtlMinimumSeconds. Cached HTTP responses are scoped per playback configuration, not per function.

- Source: Generated at build time
- Type last changed: v2.276.0 · 10 Nov 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_mediatailor as mediatailor } from 'aws-cdk-lib';
const httpRequestCacheConfigurationProperty: mediatailor.CfnFunction.HttpRequestCacheConfigurationProperty = {
  ttlMaximumSeconds: 123,
  ttlMinimumSeconds: 123,

  // the properties below are optional
  key: 'key',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_mediatailor as mediatailor

http_request_cache_configuration_property = mediatailor.CfnFunction.HttpRequestCacheConfigurationProperty(
    ttl_maximum_seconds=123,
    ttl_minimum_seconds=123,

    # the properties below are optional
    key="key"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.mediatailor.*;

HttpRequestCacheConfigurationProperty httpRequestCacheConfigurationProperty = HttpRequestCacheConfigurationProperty.builder()
        .ttlMaximumSeconds(123)
        .ttlMinimumSeconds(123)

        // the properties below are optional
        .key("key")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.MediaTailor;

var httpRequestCacheConfigurationProperty = new HttpRequestCacheConfigurationProperty {
    TtlMaximumSeconds = 123,
    TtlMinimumSeconds = 123,

    // the properties below are optional
    Key = "key"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

httpRequestCacheConfigurationProperty := &HttpRequestCacheConfigurationProperty{
	TtlMaximumSeconds: jsii.Number(123),
	TtlMinimumSeconds: jsii.Number(123),

	// the properties below are optional
	Key: jsii.String("key"),
}
```

## Properties

- `key`: string — A JSONata expression that MediaTailor evaluates to a custom cache key.

  By default, the cache key is a hash of the HTTP URL, request body, and HTTP method; request headers are not included. The evaluated key must be smaller than 1 KB.

- `ttlMaximumSeconds`: number (required) — The upper bound, in seconds, on how long MediaTailor caches a response.

  This value must be greater than or equal to TtlMinimumSeconds.

- `ttlMinimumSeconds`: number (required) — The lower bound, in seconds, on how long MediaTailor caches a response.

  MediaTailor also uses this value as the cache duration when a response has no Cache-Control max-age directive.
