# CachingConfig

CachingConfig for AppSync resolvers.

- Source: [`aws-appsync/lib/caching-config.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-appsync/lib/caching-config.ts#L6)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_appsync as appsync } from 'aws-cdk-lib';
const cachingConfig: appsync.CachingConfig = {
  ttl: cdk.Duration.minutes(30),

  // the properties below are optional
  cachingKeys: ['cachingKeys'],
};
```

Python:

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

caching_config = appsync.CachingConfig(
    ttl=cdk.Duration.minutes(30),

    # the properties below are optional
    caching_keys=["cachingKeys"]
)
```

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.*;
import software.amazon.awscdk.services.appsync.*;

CachingConfig cachingConfig = CachingConfig.builder()
        .ttl(Duration.minutes(30))

        // the properties below are optional
        .cachingKeys(List.of("cachingKeys"))
        .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;
using Amazon.CDK.AWS.AppSync;

var cachingConfig = new CachingConfig {
    Ttl = Duration.Minutes(30),

    // the properties below are optional
    CachingKeys = new [] { "cachingKeys" }
};
```

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 cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

cachingConfig := &CachingConfig{
	Ttl: cdk.Duration_Minutes(jsii.Number(30)),

	// the properties below are optional
	CachingKeys: []*string{
		jsii.String("cachingKeys"),
	},
}
```

## Properties

- `cachingKeys`: string[] — The caching keys for a resolver that has caching enabled.

  **Default:** No caching keys

  Valid values are entries from the $context.arguments, $context.source, and $context.identity maps.

- `ttl`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) (required) — The TTL in seconds for a resolver that has caching enabled.

  Valid values are between 1 and 3600 seconds.
