Compute V1 Client - Class CachePolicyNegativeCachingPolicy (2.9.0)

Reference documentation and code samples for the Compute V1 Client class CachePolicyNegativeCachingPolicy.

Specify CDN TTLs for response error codes.

Generated from protobuf message google.cloud.compute.v1.CachePolicyNegativeCachingPolicy

Namespace

Google \ Cloud \ Compute \ V1

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ code int

The HTTP status code to define a TTL against. Only HTTP status codes 300, 301, 302, 307, 308, 404, 405, 410, 421, 451 and 501 can be specified as values, and you cannot specify a status code more than once.

↳ ttl Duration

The TTL (in seconds) for which to cache responses with the corresponding status code. The maximum allowed value is 1800s (30 minutes). Infrequently accessed objects may be evicted from the cache before the defined TTL.

getCode

The HTTP status code to define a TTL against. Only HTTP status codes 300, 301, 302, 307, 308, 404, 405, 410, 421, 451 and 501 can be specified as values, and you cannot specify a status code more than once.

Returns
Type Description
int

hasCode

clearCode

setCode

The HTTP status code to define a TTL against. Only HTTP status codes 300, 301, 302, 307, 308, 404, 405, 410, 421, 451 and 501 can be specified as values, and you cannot specify a status code more than once.

Parameter
Name Description
var int
Returns
Type Description
$this

getTtl

The TTL (in seconds) for which to cache responses with the corresponding status code.

The maximum allowed value is 1800s (30 minutes). Infrequently accessed objects may be evicted from the cache before the defined TTL.

Returns
Type Description
Duration|null

hasTtl

clearTtl

setTtl

The TTL (in seconds) for which to cache responses with the corresponding status code.

The maximum allowed value is 1800s (30 minutes). Infrequently accessed objects may be evicted from the cache before the defined TTL.

Parameter
Name Description
var Duration
Returns
Type Description
$this