class CacheEngine
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ElastiCache.Alpha.CacheEngine |
Go | github.com/aws/aws-cdk-go/awscdkelasticachealpha/v2#CacheEngine |
Java | software.amazon.awscdk.services.elasticache.alpha.CacheEngine |
Python | aws_cdk.aws_elasticache_alpha.CacheEngine |
TypeScript (source) | @aws-cdk/aws-elasticache-alpha ยป CacheEngine |
Supported cache engines together with available versions.
Named instances cover the versions currently available on ElastiCache Serverless.
To target a version that is not yet represented by a named instance, use
CacheEngine.of(engineType, majorEngineVersion).
See also: https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/engine-versions.html
Example
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,
});
Properties
| Name | Type | Description |
|---|---|---|
| engine | string | The engine type, for example 'valkey', 'redis', or 'memcached'. |
| major | string | The major engine version, for example '9' or '1.6'. Maps directly to the MajorEngineVersion property of AWS::ElastiCache::ServerlessCache. When undefined, the service selects the latest major version automatically. |
| static MEMCACHED_1_6 | Cache | Memcached engine, minor version 1.6, patch version is selected automatically. |
| static MEMCACHED_LATEST | Cache | Memcached engine, latest major version available, minor version is selected automatically. |
| static REDIS_7 | Cache | Redis engine, major version 7, minor version is selected automatically. |
| static REDIS_LATEST | Cache | Redis engine, latest major version available, minor version is selected automatically. |
| static VALKEY_7 | Cache | Valkey engine, major version 7, minor version is selected automatically. |
| static VALKEY_8 | Cache | Valkey engine, major version 8, minor version is selected automatically. |
| static VALKEY_9 | Cache | Valkey engine, major version 9, minor version is selected automatically. |
| static VALKEY_LATEST | Cache | Valkey engine, latest major version available, minor version is selected automatically. |
engineType
Type:
string
The engine type, for example 'valkey', 'redis', or 'memcached'.
Maps directly to the Engine property of AWS::ElastiCache::ServerlessCache.
majorEngineVersion?
Type:
string
(optional)
The major engine version, for example '9' or '1.6'. Maps directly to the MajorEngineVersion property of AWS::ElastiCache::ServerlessCache. When undefined, the service selects the latest major version automatically.
static MEMCACHED_1_6
Type:
Cache
Memcached engine, minor version 1.6, patch version is selected automatically.
static MEMCACHED_LATEST
Type:
Cache
Memcached engine, latest major version available, minor version is selected automatically.
static REDIS_7
Type:
Cache
Redis engine, major version 7, minor version is selected automatically.
static REDIS_LATEST
Type:
Cache
Redis engine, latest major version available, minor version is selected automatically.
static VALKEY_7
Type:
Cache
Valkey engine, major version 7, minor version is selected automatically.
static VALKEY_8
Type:
Cache
Valkey engine, major version 8, minor version is selected automatically.
static VALKEY_9
Type:
Cache
Valkey engine, major version 9, minor version is selected automatically.
static VALKEY_LATEST
Type:
Cache
Valkey engine, latest major version available, minor version is selected automatically.
Methods
| Name | Description |
|---|---|
| to | Returns a string representation of this cache engine, for logging and error messages. |
| static of(engineType, majorEngineVersion?) | Create a new CacheEngine with an arbitrary engine type and major version. |
toString()
public toString(): string
Returns
string
Returns a string representation of this cache engine, for logging and error messages.
The format is engineType_majorEngineVersion when a
major version is set, or just engineType otherwise (for example,
'valkey_8', 'memcached_1.6', 'redis').
static of(engineType, majorEngineVersion?)
public static of(engineType: string, majorEngineVersion?: string): CacheEngine
Parameters
- engineType
stringโ the engine type (for example,'valkey','redis', or'memcached'). - majorEngineVersion
stringโ the major engine version (for example,'9').
Returns
Create a new CacheEngine with an arbitrary engine type and major version.
Use this for engine/version combinations that are not yet represented by a named static member.

.NET
Go
Java
Python
TypeScript (