Class: Google::Apis::ComputeAlpha::CachePolicy

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
lib/google/apis/compute_alpha/classes.rb,
lib/google/apis/compute_alpha/representations.rb,
lib/google/apis/compute_alpha/representations.rb

Overview

Message containing CachePolicy configuration for URL Map's Route Action.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ CachePolicy

Returns a new instance of CachePolicy.



8021
8022
8023
# File 'lib/google/apis/compute_alpha/classes.rb', line 8021

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#cache_bypass_request_header_namesArray<String>

Bypass the cache when the specified request headers are matched by name, e.g. Pragma or Authorization headers. Values are case-insensitive. Up to 5 header names can be specified. The cache is bypassed for all cacheMode values. Corresponds to the JSON property cacheBypassRequestHeaderNames

Returns:

  • (Array<String>)


7935
7936
7937
# File 'lib/google/apis/compute_alpha/classes.rb', line 7935

def cache_bypass_request_header_names
  @cache_bypass_request_header_names
end

#cache_key_policyGoogle::Apis::ComputeAlpha::CachePolicyCacheKeyPolicy

Message containing what to include in the cache key for a request for Cache Policy defined on Route Action. Corresponds to the JSON property cacheKeyPolicy



7941
7942
7943
# File 'lib/google/apis/compute_alpha/classes.rb', line 7941

def cache_key_policy
  @cache_key_policy
end

#cache_modeString

Specifies the cache setting for all responses from this route. If not specified, Cloud CDN uses CACHE_ALL_STATIC mode. Corresponds to the JSON property cacheMode

Returns:

  • (String)


7947
7948
7949
# File 'lib/google/apis/compute_alpha/classes.rb', line 7947

def cache_mode
  @cache_mode
end

#client_ttlGoogle::Apis::ComputeAlpha::Duration

A Duration represents a fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". Range is approximately 10,000 years. Corresponds to the JSON property clientTtl



7955
7956
7957
# File 'lib/google/apis/compute_alpha/classes.rb', line 7955

def client_ttl
  @client_ttl
end

#default_ttlGoogle::Apis::ComputeAlpha::Duration

A Duration represents a fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". Range is approximately 10,000 years. Corresponds to the JSON property defaultTtl



7963
7964
7965
# File 'lib/google/apis/compute_alpha/classes.rb', line 7963

def default_ttl
  @default_ttl
end

#max_ttlGoogle::Apis::ComputeAlpha::Duration

A Duration represents a fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". Range is approximately 10,000 years. Corresponds to the JSON property maxTtl



7971
7972
7973
# File 'lib/google/apis/compute_alpha/classes.rb', line 7971

def max_ttl
  @max_ttl
end

#negative_cachingBoolean Also known as: negative_caching?

Negative caching allows per-status code TTLs to be set, in order to apply fine-grained caching for common errors or redirects. This can reduce the load on your origin and improve end-user experience by reducing response latency. When the cacheMode is set to CACHE_ALL_STATIC or USE_ORIGIN_HEADERS, negative caching applies to responses with the specified response code that lack any Cache-Control, Expires, or Pragma: no-cache directives. When the cacheMode is set to FORCE_CACHE_ALL, negative caching applies to all responses with the specified response code, and overrides any caching headers. By default, Cloud CDN applies the following TTLs to these HTTP status codes:

  • 300 (Multiple Choice), 301, 308 (Permanent Redirects): 10m
  • 404 (Not Found), 410 (Gone), 451 (Unavailable For Legal Reasons): 120s
  • 405 (Method Not Found), 501 (Not Implemented): 60s These defaults can be overridden in negativeCachingPolicy. If not specified, Cloud CDN applies negative caching by default. Corresponds to the JSON property negativeCaching

Returns:

  • (Boolean)


7991
7992
7993
# File 'lib/google/apis/compute_alpha/classes.rb', line 7991

def negative_caching
  @negative_caching
end

#negative_caching_policyArray<Google::Apis::ComputeAlpha::CachePolicyNegativeCachingPolicy>

Sets a cache TTL for the specified HTTP status code. negativeCaching must be enabled to configure negativeCachingPolicy. Omitting the policy and leaving negativeCaching enabled will use Cloud CDN's default cache TTLs. Note that when specifying an explicit negativeCachingPolicy, you should take care to specify a cache TTL for all response codes that you wish to cache. Cloud CDN will not apply any default negative caching when a policy exists. Corresponds to the JSON property negativeCachingPolicy



8003
8004
8005
# File 'lib/google/apis/compute_alpha/classes.rb', line 8003

def negative_caching_policy
  @negative_caching_policy
end

#request_coalescingBoolean Also known as: request_coalescing?

If true then Cloud CDN will combine multiple concurrent cache fill requests into a small number of requests to the origin. If not specified, Cloud CDN applies request coalescing by default. Corresponds to the JSON property requestCoalescing

Returns:

  • (Boolean)


8010
8011
8012
# File 'lib/google/apis/compute_alpha/classes.rb', line 8010

def request_coalescing
  @request_coalescing
end

#serve_while_staleGoogle::Apis::ComputeAlpha::Duration

A Duration represents a fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". Range is approximately 10,000 years. Corresponds to the JSON property serveWhileStale



8019
8020
8021
# File 'lib/google/apis/compute_alpha/classes.rb', line 8019

def serve_while_stale
  @serve_while_stale
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
# File 'lib/google/apis/compute_alpha/classes.rb', line 8026

def update!(**args)
  @cache_bypass_request_header_names = args[:cache_bypass_request_header_names] if args.key?(:cache_bypass_request_header_names)
  @cache_key_policy = args[:cache_key_policy] if args.key?(:cache_key_policy)
  @cache_mode = args[:cache_mode] if args.key?(:cache_mode)
  @client_ttl = args[:client_ttl] if args.key?(:client_ttl)
  @default_ttl = args[:default_ttl] if args.key?(:default_ttl)
  @max_ttl = args[:max_ttl] if args.key?(:max_ttl)
  @negative_caching = args[:negative_caching] if args.key?(:negative_caching)
  @negative_caching_policy = args[:negative_caching_policy] if args.key?(:negative_caching_policy)
  @request_coalescing = args[:request_coalescing] if args.key?(:request_coalescing)
  @serve_while_stale = args[:serve_while_stale] if args.key?(:serve_while_stale)
end