Class CacheControl
Used for HTTP cache-control header, which influences downstream caches.
Inheritance
Namespace: Amazon.CDK.AWS.S3.Deployment
Assembly: Amazon.CDK.AWS.S3.Deployment.dll
Syntax (csharp)
public class CacheControl : DeputyBase
Syntax (vb)
Public Class CacheControl
Inherits DeputyBase
Remarks
See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata
ExampleMetadata: infused
Examples
Bucket destinationBucket;
new BucketDeployment(this, "BucketDeployment", new BucketDeploymentProps {
Sources = new [] { Source.Asset("./website", new AssetOptions { Exclude = new [] { "index.html" } }) },
DestinationBucket = destinationBucket,
CacheControl = new [] { CacheControl.FromString("max-age=31536000,public,immutable") },
Prune = false
});
new BucketDeployment(this, "HTMLBucketDeployment", new BucketDeploymentProps {
Sources = new [] { Source.Asset("./website", new AssetOptions { Exclude = new [] { "*", "!index.html" } }) },
DestinationBucket = destinationBucket,
CacheControl = new [] { CacheControl.FromString("max-age=0,no-cache,no-store,must-revalidate") },
Prune = false
});
Synopsis
Constructors
CacheControl(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CacheControl(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Value | The raw cache control setting. |
Methods
FromString(String) | Constructs a custom cache control key from the literal value. |
MaxAge(Duration) | Sets 'max-age=<duration-in-seconds>'. |
MustRevalidate() | Sets 'must-revalidate'. |
NoCache() | Sets 'no-cache'. |
NoTransform() | Sets 'no-transform'. |
ProxyRevalidate() | Sets 'proxy-revalidate'. |
SetPrivate() | Sets 'private'. |
SetPublic() | Sets 'public'. |
SMaxAge(Duration) | Sets 's-maxage=<duration-in-seconds>'. |
Constructors
CacheControl(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CacheControl(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CacheControl(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CacheControl(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Value
The raw cache control setting.
public virtual object Value { get; }
Property Value
System.Object
Methods
FromString(String)
Constructs a custom cache control key from the literal value.
public static CacheControl FromString(string s)
Parameters
- s System.String
Returns
MaxAge(Duration)
Sets 'max-age=<duration-in-seconds>'.
public static CacheControl MaxAge(Duration t)
Parameters
- t Duration
Returns
MustRevalidate()
NoCache()
NoTransform()
ProxyRevalidate()
SetPrivate()
SetPublic()
SMaxAge(Duration)
Sets 's-maxage=<duration-in-seconds>'.
public static CacheControl SMaxAge(Duration t)
Parameters
- t Duration
Returns