# CfnApiCacheProps

Properties for defining a `CfnApiCache`.

Used as props by: [CfnApiCache](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnApiCache.html)

- Source: Generated at build time
- Type last changed: v2.129.0 · 21 Feb 2024

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
const cfnApiCacheProps: appsync.CfnApiCacheProps = {
  apiCachingBehavior: 'apiCachingBehavior',
  apiId: 'apiId',
  ttl: 123,
  type: 'type',

  // the properties below are optional
  atRestEncryptionEnabled: false,
  healthMetricsConfig: 'healthMetricsConfig',
  transitEncryptionEnabled: false,
};
```

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_appsync as appsync

cfn_api_cache_props = appsync.CfnApiCacheProps(
    api_caching_behavior="apiCachingBehavior",
    api_id="apiId",
    ttl=123,
    type="type",

    # the properties below are optional
    at_rest_encryption_enabled=False,
    health_metrics_config="healthMetricsConfig",
    transit_encryption_enabled=False
)
```

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.appsync.*;

CfnApiCacheProps cfnApiCacheProps = CfnApiCacheProps.builder()
        .apiCachingBehavior("apiCachingBehavior")
        .apiId("apiId")
        .ttl(123)
        .type("type")

        // the properties below are optional
        .atRestEncryptionEnabled(false)
        .healthMetricsConfig("healthMetricsConfig")
        .transitEncryptionEnabled(false)
        .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.AppSync;

var cfnApiCacheProps = new CfnApiCacheProps {
    ApiCachingBehavior = "apiCachingBehavior",
    ApiId = "apiId",
    Ttl = 123,
    Type = "type",

    // the properties below are optional
    AtRestEncryptionEnabled = false,
    HealthMetricsConfig = "healthMetricsConfig",
    TransitEncryptionEnabled = false
};
```

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"

cfnApiCacheProps := &CfnApiCacheProps{
	ApiCachingBehavior: jsii.String("apiCachingBehavior"),
	ApiId: jsii.String("apiId"),
	Ttl: jsii.Number(123),
	Type: jsii.String("type"),

	// the properties below are optional
	AtRestEncryptionEnabled: jsii.Boolean(false),
	HealthMetricsConfig: jsii.String("healthMetricsConfig"),
	TransitEncryptionEnabled: jsii.Boolean(false),
}
```

## Properties

- `apiCachingBehavior`: string (required) — Caching behavior.

  - *FULL_REQUEST_CACHING* : All requests from the same user are cached. Individual resolvers are automatically cached. All API calls will try to return responses from the cache.
  - *PER_RESOLVER_CACHING* : Individual resolvers that you specify are cached.
  - *OPERATION_LEVEL_CACHING* : Full requests are cached together and returned without executing resolvers.

- `apiId`: string (required) — The GraphQL API ID.

- `atRestEncryptionEnabled`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — *This parameter has been deprecated* .

  At-rest encryption flag for cache. You cannot update this setting after creation.

- `healthMetricsConfig`: string — Controls how cache health metrics will be emitted to CloudWatch. Cache health metrics include:.

  - *NetworkBandwidthOutAllowanceExceeded* : The network packets dropped because the throughput exceeded the aggregated bandwidth limit. This is useful for diagnosing bottlenecks in a cache configuration.
  - *EngineCPUUtilization* : The CPU utilization (percentage) allocated to the Redis process. This is useful for diagnosing bottlenecks in a cache configuration.

  Metrics will be recorded by API ID. You can set the value to `ENABLED` or `DISABLED` .

- `transitEncryptionEnabled`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — *This parameter has been deprecated* .

  Transit encryption flag when connecting to cache. You cannot update this setting after creation.

- `ttl`: number (required) — TTL in seconds for cache entries.

  Valid values are 1–3,600 seconds.

- `type`: string (required) — The cache instance type. Valid values are.

  - `SMALL`
  - `MEDIUM`
  - `LARGE`
  - `XLARGE`
  - `LARGE_2X`
  - `LARGE_4X`
  - `LARGE_8X` (not available in all regions)
  - `LARGE_12X`

  Historically, instance types were identified by an EC2-style value. As of July 2020, this is deprecated, and the generic identifiers above should be used.

  The following legacy instance types are available, but their use is discouraged:

  - *T2_SMALL* : A t2.small instance type.
  - *T2_MEDIUM* : A t2.medium instance type.
  - *R4_LARGE* : A r4.large instance type.
  - *R4_XLARGE* : A r4.xlarge instance type.
  - *R4_2XLARGE* : A r4.2xlarge instance type.
  - *R4_4XLARGE* : A r4.4xlarge instance type.
  - *R4_8XLARGE* : A r4.8xlarge instance type.
