> **Experimental**
>
> `@aws-cdk/aws-elasticache-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# ServerlessCacheProps

Properties for defining a ServerlessCache.

Used as props by: [ServerlessCache](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.ServerlessCache.html)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/serverless-cache.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-elasticache-alpha/lib/serverless-cache.ts#L108)

## Example

TypeScript:

```ts
declare const vpc: ec2.Vpc;

const serverlessCache = new elasticache.ServerlessCache(this, 'ServerlessCache', {
  engine: elasticache.CacheEngine.VALKEY_LATEST,
  backup: {
    // set a backup name before deleting a cache
    backupNameBeforeDeletion: "my-final-backup-name",
  },
  vpc,
});
```

Python:

```python
# vpc: ec2.Vpc

serverless_cache = elasticache.ServerlessCache(self, "ServerlessCache",
    engine=elasticache.CacheEngine.VALKEY_LATEST,
    backup=elasticache.BackupSettings(
        # set a backup name before deleting a cache
        backup_name_before_deletion="my-final-backup-name"
    ),
    vpc=vpc
)
```

Java:

```java
Vpc vpc;

ServerlessCache serverlessCache = ServerlessCache.Builder.create(this, "ServerlessCache")
        .engine(CacheEngine.VALKEY_LATEST)
        .backup(BackupSettings.builder()
                // set a backup name before deleting a cache
                .backupNameBeforeDeletion("my-final-backup-name")
                .build())
        .vpc(vpc)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ElastiCache.Alpha
Vpc vpc;

var serverlessCache = new ServerlessCache(this, "ServerlessCache", new ServerlessCacheProps {
    Engine = CacheEngine.VALKEY_LATEST,
    Backup = new BackupSettings {
        // set a backup name before deleting a cache
        BackupNameBeforeDeletion = "my-final-backup-name"
    },
    Vpc = vpc
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkelasticachealpha/v2
var vpc Vpc

serverlessCache := elasticache.NewServerlessCache(this, jsii.String("ServerlessCache"), &ServerlessCacheProps{
	Engine: elasticache.CacheEngine_VALKEY_LATEST(),
	Backup: &BackupSettings{
		// set a backup name before deleting a cache
		BackupNameBeforeDeletion: jsii.String("my-final-backup-name"),
	},
	Vpc: Vpc,
})
```

## Properties

- `backup`: [BackupSettings](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.BackupSettings.html) — Backup configuration.

  **Default:** No backups configured

- `cacheUsageLimits`: [CacheUsageLimitsProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.CacheUsageLimitsProperty.html) — Usage limits for the cache.

  **Default:** No usage limits

- `description`: string — A description for the cache.

  **Default:** No description

- `engine`: [CacheEngine](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.CacheEngine.html) — The cache engine combined with the version Enum options: VALKEY_DEFAULT, VALKEY_7, VALKEY_8, REDIS_DEFAULT, MEMCACHED_DEFAULT The default options bring the latest versions available.

  **Default:** when not provided, the default engine would be Valkey, latest version available (VALKEY_DEFAULT)

- `kmsKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — KMS key for encryption.

  **Default:** Service managed encryption (AWS owned KMS key)

- `securityGroups`: [ISecurityGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — Security groups for the cache.

  **Default:** A new security group is created

- `serverlessCacheName`: string — Name for the serverless cache.

  **Default:** automatically generated name by Resource

- `userGroup`: [IUserGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.IUserGroup.html) — User group for access control.

  **Default:** No user group

- `vpc`: [IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — The VPC to place the cache in.

- `vpcSubnets`: [SubnetSelection](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — Which subnets to place the cache in.

  **Default:** Private subnets with egress
