Skip to content

CloudFront  >  Operations  >  update_cache_policy

update_cache_policy

Operation

update_cache_policy async

update_cache_policy(input: UpdateCachePolicyInput, plugins: list[Plugin] | None = None) -> UpdateCachePolicyOutput

Updates a cache policy configuration.

When you update a cache policy configuration, all the fields are updated with the values provided in the request. You cannot update some fields independent of others. To update a cache policy configuration:

  1. Use GetCachePolicyConfig to get the current configuration.

  2. Locally modify the fields in the cache policy configuration that you want to update.

  3. Call UpdateCachePolicy by providing the entire cache policy configuration, including the fields that you modified and those that you didn't.

Warning

If your minimum TTL is greater than 0, CloudFront will cache content for at least the duration specified in the cache policy's minimum TTL, even if the Cache-Control: no-cache, no-store, or private directives are present in the origin headers.

Parameters:

Name Type Description Default
input UpdateCachePolicyInput

An instance of UpdateCachePolicyInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
UpdateCachePolicyOutput

An instance of UpdateCachePolicyOutput.

Input

UpdateCachePolicyInput dataclass

Bases: _SerdeShape

Dataclass for UpdateCachePolicyInput structure.

Attributes

cache_policy_config class-attribute instance-attribute
cache_policy_config: CachePolicyConfig | None = ...

A cache policy configuration.

id class-attribute instance-attribute
id: str | None = ...

The unique identifier for the cache policy that you are updating. The identifier is returned in a cache behavior's CachePolicyId field in the response to GetDistributionConfig.

if_match class-attribute instance-attribute
if_match: str | None = ...

The version of the cache policy that you are updating. The version is returned in the cache policy's ETag field in the response to GetCachePolicyConfig.

Output

UpdateCachePolicyOutput dataclass

Bases: _SerdeShape

Dataclass for UpdateCachePolicyOutput structure.

Attributes

cache_policy class-attribute instance-attribute
cache_policy: CachePolicy | None = ...

A cache policy.

e_tag class-attribute instance-attribute
e_tag: str | None = ...

The current version of the cache policy.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.