Class CachePolicy
A Cache Policy configuration.
Inherited Members
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CachePolicy : Resource, IResource, ICachePolicy
Syntax (vb)
Public Class CachePolicy
Inherits Resource
Implements IResource, ICachePolicy
Remarks
Link: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html
Resource: AWS::CloudFront::CachePolicy
ExampleMetadata: infused
Examples
// Using an existing cache policy for a Distribution
S3Origin bucketOrigin;
new Distribution(this, "myDistManagedPolicy", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = bucketOrigin,
CachePolicy = CachePolicy.CACHING_OPTIMIZED
}
});
Synopsis
Constructors
CachePolicy(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CachePolicy(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CachePolicy(Construct, String, ICachePolicyProps) |
Properties
AMPLIFY | This policy is designed for use with an origin that is an AWS Amplify web app. |
CachePolicyId | The ID of the cache policy. |
CACHING_DISABLED | Disables caching. |
CACHING_OPTIMIZED | Optimize cache efficiency by minimizing the values that CloudFront includes in the cache key. |
CACHING_OPTIMIZED_FOR_UNCOMPRESSED_OBJECTS | Optimize cache efficiency by minimizing the values that CloudFront includes in the cache key. |
ELEMENTAL_MEDIA_PACKAGE | Designed for use with an origin that is an AWS Elemental MediaPackage endpoint. |
Methods
FromCachePolicyId(Construct, String, String) | Imports a Cache Policy from its id. |
Constructors
CachePolicy(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CachePolicy(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CachePolicy(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CachePolicy(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CachePolicy(Construct, String, ICachePolicyProps)
public CachePolicy(Construct scope, string id, ICachePolicyProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props ICachePolicyProps
Properties
AMPLIFY
This policy is designed for use with an origin that is an AWS Amplify web app.
public static ICachePolicy AMPLIFY { get; }
Property Value
CachePolicyId
The ID of the cache policy.
public virtual string CachePolicyId { get; }
Property Value
System.String
CACHING_DISABLED
Disables caching.
public static ICachePolicy CACHING_DISABLED { get; }
Property Value
Remarks
This policy is useful for dynamic content and for requests that are not cacheable.
CACHING_OPTIMIZED
Optimize cache efficiency by minimizing the values that CloudFront includes in the cache key.
public static ICachePolicy CACHING_OPTIMIZED { get; }
Property Value
Remarks
Query strings and cookies are not included in the cache key, and only the normalized 'Accept-Encoding' header is included.
CACHING_OPTIMIZED_FOR_UNCOMPRESSED_OBJECTS
Optimize cache efficiency by minimizing the values that CloudFront includes in the cache key.
public static ICachePolicy CACHING_OPTIMIZED_FOR_UNCOMPRESSED_OBJECTS { get; }
Property Value
Remarks
Query strings and cookies are not included in the cache key, and only the normalized 'Accept-Encoding' header is included. Disables cache compression.
ELEMENTAL_MEDIA_PACKAGE
Designed for use with an origin that is an AWS Elemental MediaPackage endpoint.
public static ICachePolicy ELEMENTAL_MEDIA_PACKAGE { get; }
Property Value
Methods
FromCachePolicyId(Construct, String, String)
Imports a Cache Policy from its id.
public static ICachePolicy FromCachePolicyId(Construct scope, string id, string cachePolicyId)
Parameters
- scope Constructs.Construct
- id System.String
- cachePolicyId System.String
Returns