-
Notifications
You must be signed in to change notification settings - Fork 461
Expand file tree
/
Copy pathCachePolicy.php
More file actions
733 lines (681 loc) · 34.1 KB
/
CachePolicy.php
File metadata and controls
733 lines (681 loc) · 34.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/compute/v1/compute.proto
namespace Google\Cloud\Compute\V1;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;
/**
* Message containing CachePolicy configuration for URL Map's Route Action.
*
* Generated from protobuf message <code>google.cloud.compute.v1.CachePolicy</code>
*/
class CachePolicy extends \Google\Protobuf\Internal\Message
{
/**
* 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.
*
* Generated from protobuf field <code>repeated string cache_bypass_request_header_names = 197581440;</code>
*/
private $cache_bypass_request_header_names;
/**
* The cache key configuration. If not specified, the default behavior depends
* on the backend type: for Backend Services, the complete request URI is
* used; for Backend Buckets, the request URI is used without the protocol or
* host, and only query parameters known to Cloud Storage are included.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.CachePolicyCacheKeyPolicy cache_key_policy = 159263727;</code>
*/
protected $cache_key_policy = null;
/**
* Specifies the cache setting for all responses from this route. If not
* specified, Cloud CDN uses `CACHE_ALL_STATIC` mode.
* Check the CacheMode enum for the list of possible values.
*
* Generated from protobuf field <code>optional string cache_mode = 28877888;</code>
*/
protected $cache_mode = null;
/**
* Specifies a separate client (e.g. browser client) maximum TTL for cached
* content. This is used to clamp the max-age (or Expires) value sent to the
* client. With `FORCE_CACHE_ALL`, the lesser of `clientTtl` and `defaultTtl`
* is used for the response max-age directive, along with a "public"
* directive. For cacheable content in `CACHE_ALL_STATIC` mode, `clientTtl`
* clamps the max-age from the origin (if specified), or else sets the
* response max-age directive to the lesser of the `clientTtl` and
* `defaultTtl`, and also ensures a "public" cache-control directive is
* present. The maximum allowed value is 31,622,400s (1 year). If not
* specified, Cloud CDN uses 3600s (1 hour) for `CACHE_ALL_STATIC` mode.
* Cannot exceed `maxTtl`. Cannot be specified when `cacheMode` is
* `USE_ORIGIN_HEADERS`.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration client_ttl = 29034360;</code>
*/
protected $client_ttl = null;
/**
* Specifies the default TTL for cached content for responses that do not have
* an existing valid TTL (max-age or s-maxage). Setting a TTL of "0" means
* "always revalidate". The value of `defaultTtl` cannot be set to a value
* greater than that of `maxTtl`. When the `cacheMode` is set to
* `FORCE_CACHE_ALL`, the `defaultTtl` will overwrite the TTL set in all
* responses. The maximum allowed value is 31,622,400s (1 year). Infrequently
* accessed objects may be evicted from the cache before the defined TTL. If
* not specified, Cloud CDN uses 3600s (1 hour) for `CACHE_ALL_STATIC` and
* `FORCE_CACHE_ALL` modes. Cannot be specified when `cacheMode` is
* `USE_ORIGIN_HEADERS`.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration default_ttl = 100253422;</code>
*/
protected $default_ttl = null;
/**
* Specifies the maximum allowed TTL for cached content. Cache directives that
* attempt to set a max-age or s-maxage higher than this, or an Expires header
* more than `maxTtl` seconds in the future will be capped at the value of
* `maxTtl`, as if it were the value of an s-maxage Cache-Control directive.
* Headers sent to the client will not be modified. Setting a TTL of "0" means
* "always revalidate". The maximum allowed value is 31,622,400s (1 year).
* Infrequently accessed objects may be evicted from the cache before the
* defined TTL. If not specified, Cloud CDN uses 86400s (1 day) for
* `CACHE_ALL_STATIC` mode. Can be specified only for `CACHE_ALL_STATIC` cache
* mode.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration max_ttl = 307578001;</code>
*/
protected $max_ttl = null;
/**
* 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.
*
* Generated from protobuf field <code>optional bool negative_caching = 336110005;</code>
*/
protected $negative_caching = null;
/**
* 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.
*
* Generated from protobuf field <code>repeated .google.cloud.compute.v1.CachePolicyNegativeCachingPolicy negative_caching_policy = 155359996;</code>
*/
private $negative_caching_policy;
/**
* 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.
*
* Generated from protobuf field <code>optional bool request_coalescing = 532808276;</code>
*/
protected $request_coalescing = null;
/**
* Serve existing content from the cache (if available) when revalidating
* content with the origin, or when an error is encountered when refreshing
* the cache.
* This setting defines the default "max-stale" duration for any cached
* responses that do not specify a max-stale directive. Stale responses that
* exceed the TTL configured here will not be served. The default limit
* (max-stale) is 86400s (1 day), which will allow stale content to be
* served up to this limit beyond the max-age (or s-maxage) of a cached
* response.
* The maximum allowed value is 604800 (1 week).
* Set this to zero (0) to disable serve-while-stale.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration serve_while_stale = 236682203;</code>
*/
protected $serve_while_stale = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string[] $cache_bypass_request_header_names
* 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.
* @type \Google\Cloud\Compute\V1\CachePolicyCacheKeyPolicy $cache_key_policy
* The cache key configuration. If not specified, the default behavior depends
* on the backend type: for Backend Services, the complete request URI is
* used; for Backend Buckets, the request URI is used without the protocol or
* host, and only query parameters known to Cloud Storage are included.
* @type string $cache_mode
* Specifies the cache setting for all responses from this route. If not
* specified, Cloud CDN uses `CACHE_ALL_STATIC` mode.
* Check the CacheMode enum for the list of possible values.
* @type \Google\Cloud\Compute\V1\Duration $client_ttl
* Specifies a separate client (e.g. browser client) maximum TTL for cached
* content. This is used to clamp the max-age (or Expires) value sent to the
* client. With `FORCE_CACHE_ALL`, the lesser of `clientTtl` and `defaultTtl`
* is used for the response max-age directive, along with a "public"
* directive. For cacheable content in `CACHE_ALL_STATIC` mode, `clientTtl`
* clamps the max-age from the origin (if specified), or else sets the
* response max-age directive to the lesser of the `clientTtl` and
* `defaultTtl`, and also ensures a "public" cache-control directive is
* present. The maximum allowed value is 31,622,400s (1 year). If not
* specified, Cloud CDN uses 3600s (1 hour) for `CACHE_ALL_STATIC` mode.
* Cannot exceed `maxTtl`. Cannot be specified when `cacheMode` is
* `USE_ORIGIN_HEADERS`.
* @type \Google\Cloud\Compute\V1\Duration $default_ttl
* Specifies the default TTL for cached content for responses that do not have
* an existing valid TTL (max-age or s-maxage). Setting a TTL of "0" means
* "always revalidate". The value of `defaultTtl` cannot be set to a value
* greater than that of `maxTtl`. When the `cacheMode` is set to
* `FORCE_CACHE_ALL`, the `defaultTtl` will overwrite the TTL set in all
* responses. The maximum allowed value is 31,622,400s (1 year). Infrequently
* accessed objects may be evicted from the cache before the defined TTL. If
* not specified, Cloud CDN uses 3600s (1 hour) for `CACHE_ALL_STATIC` and
* `FORCE_CACHE_ALL` modes. Cannot be specified when `cacheMode` is
* `USE_ORIGIN_HEADERS`.
* @type \Google\Cloud\Compute\V1\Duration $max_ttl
* Specifies the maximum allowed TTL for cached content. Cache directives that
* attempt to set a max-age or s-maxage higher than this, or an Expires header
* more than `maxTtl` seconds in the future will be capped at the value of
* `maxTtl`, as if it were the value of an s-maxage Cache-Control directive.
* Headers sent to the client will not be modified. Setting a TTL of "0" means
* "always revalidate". The maximum allowed value is 31,622,400s (1 year).
* Infrequently accessed objects may be evicted from the cache before the
* defined TTL. If not specified, Cloud CDN uses 86400s (1 day) for
* `CACHE_ALL_STATIC` mode. Can be specified only for `CACHE_ALL_STATIC` cache
* mode.
* @type bool $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.
* @type \Google\Cloud\Compute\V1\CachePolicyNegativeCachingPolicy[] $negative_caching_policy
* 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.
* @type bool $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.
* @type \Google\Cloud\Compute\V1\Duration $serve_while_stale
* Serve existing content from the cache (if available) when revalidating
* content with the origin, or when an error is encountered when refreshing
* the cache.
* This setting defines the default "max-stale" duration for any cached
* responses that do not specify a max-stale directive. Stale responses that
* exceed the TTL configured here will not be served. The default limit
* (max-stale) is 86400s (1 day), which will allow stale content to be
* served up to this limit beyond the max-age (or s-maxage) of a cached
* response.
* The maximum allowed value is 604800 (1 week).
* Set this to zero (0) to disable serve-while-stale.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
parent::__construct($data);
}
/**
* 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.
*
* Generated from protobuf field <code>repeated string cache_bypass_request_header_names = 197581440;</code>
* @return RepeatedField<string>
*/
public function getCacheBypassRequestHeaderNames()
{
return $this->cache_bypass_request_header_names;
}
/**
* 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.
*
* Generated from protobuf field <code>repeated string cache_bypass_request_header_names = 197581440;</code>
* @param string[] $var
* @return $this
*/
public function setCacheBypassRequestHeaderNames($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->cache_bypass_request_header_names = $arr;
return $this;
}
/**
* The cache key configuration. If not specified, the default behavior depends
* on the backend type: for Backend Services, the complete request URI is
* used; for Backend Buckets, the request URI is used without the protocol or
* host, and only query parameters known to Cloud Storage are included.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.CachePolicyCacheKeyPolicy cache_key_policy = 159263727;</code>
* @return \Google\Cloud\Compute\V1\CachePolicyCacheKeyPolicy|null
*/
public function getCacheKeyPolicy()
{
return $this->cache_key_policy;
}
public function hasCacheKeyPolicy()
{
return isset($this->cache_key_policy);
}
public function clearCacheKeyPolicy()
{
unset($this->cache_key_policy);
}
/**
* The cache key configuration. If not specified, the default behavior depends
* on the backend type: for Backend Services, the complete request URI is
* used; for Backend Buckets, the request URI is used without the protocol or
* host, and only query parameters known to Cloud Storage are included.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.CachePolicyCacheKeyPolicy cache_key_policy = 159263727;</code>
* @param \Google\Cloud\Compute\V1\CachePolicyCacheKeyPolicy $var
* @return $this
*/
public function setCacheKeyPolicy($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\CachePolicyCacheKeyPolicy::class);
$this->cache_key_policy = $var;
return $this;
}
/**
* Specifies the cache setting for all responses from this route. If not
* specified, Cloud CDN uses `CACHE_ALL_STATIC` mode.
* Check the CacheMode enum for the list of possible values.
*
* Generated from protobuf field <code>optional string cache_mode = 28877888;</code>
* @return string
*/
public function getCacheMode()
{
return isset($this->cache_mode) ? $this->cache_mode : '';
}
public function hasCacheMode()
{
return isset($this->cache_mode);
}
public function clearCacheMode()
{
unset($this->cache_mode);
}
/**
* Specifies the cache setting for all responses from this route. If not
* specified, Cloud CDN uses `CACHE_ALL_STATIC` mode.
* Check the CacheMode enum for the list of possible values.
*
* Generated from protobuf field <code>optional string cache_mode = 28877888;</code>
* @param string $var
* @return $this
*/
public function setCacheMode($var)
{
GPBUtil::checkString($var, True);
$this->cache_mode = $var;
return $this;
}
/**
* Specifies a separate client (e.g. browser client) maximum TTL for cached
* content. This is used to clamp the max-age (or Expires) value sent to the
* client. With `FORCE_CACHE_ALL`, the lesser of `clientTtl` and `defaultTtl`
* is used for the response max-age directive, along with a "public"
* directive. For cacheable content in `CACHE_ALL_STATIC` mode, `clientTtl`
* clamps the max-age from the origin (if specified), or else sets the
* response max-age directive to the lesser of the `clientTtl` and
* `defaultTtl`, and also ensures a "public" cache-control directive is
* present. The maximum allowed value is 31,622,400s (1 year). If not
* specified, Cloud CDN uses 3600s (1 hour) for `CACHE_ALL_STATIC` mode.
* Cannot exceed `maxTtl`. Cannot be specified when `cacheMode` is
* `USE_ORIGIN_HEADERS`.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration client_ttl = 29034360;</code>
* @return \Google\Cloud\Compute\V1\Duration|null
*/
public function getClientTtl()
{
return $this->client_ttl;
}
public function hasClientTtl()
{
return isset($this->client_ttl);
}
public function clearClientTtl()
{
unset($this->client_ttl);
}
/**
* Specifies a separate client (e.g. browser client) maximum TTL for cached
* content. This is used to clamp the max-age (or Expires) value sent to the
* client. With `FORCE_CACHE_ALL`, the lesser of `clientTtl` and `defaultTtl`
* is used for the response max-age directive, along with a "public"
* directive. For cacheable content in `CACHE_ALL_STATIC` mode, `clientTtl`
* clamps the max-age from the origin (if specified), or else sets the
* response max-age directive to the lesser of the `clientTtl` and
* `defaultTtl`, and also ensures a "public" cache-control directive is
* present. The maximum allowed value is 31,622,400s (1 year). If not
* specified, Cloud CDN uses 3600s (1 hour) for `CACHE_ALL_STATIC` mode.
* Cannot exceed `maxTtl`. Cannot be specified when `cacheMode` is
* `USE_ORIGIN_HEADERS`.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration client_ttl = 29034360;</code>
* @param \Google\Cloud\Compute\V1\Duration $var
* @return $this
*/
public function setClientTtl($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\Duration::class);
$this->client_ttl = $var;
return $this;
}
/**
* Specifies the default TTL for cached content for responses that do not have
* an existing valid TTL (max-age or s-maxage). Setting a TTL of "0" means
* "always revalidate". The value of `defaultTtl` cannot be set to a value
* greater than that of `maxTtl`. When the `cacheMode` is set to
* `FORCE_CACHE_ALL`, the `defaultTtl` will overwrite the TTL set in all
* responses. The maximum allowed value is 31,622,400s (1 year). Infrequently
* accessed objects may be evicted from the cache before the defined TTL. If
* not specified, Cloud CDN uses 3600s (1 hour) for `CACHE_ALL_STATIC` and
* `FORCE_CACHE_ALL` modes. Cannot be specified when `cacheMode` is
* `USE_ORIGIN_HEADERS`.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration default_ttl = 100253422;</code>
* @return \Google\Cloud\Compute\V1\Duration|null
*/
public function getDefaultTtl()
{
return $this->default_ttl;
}
public function hasDefaultTtl()
{
return isset($this->default_ttl);
}
public function clearDefaultTtl()
{
unset($this->default_ttl);
}
/**
* Specifies the default TTL for cached content for responses that do not have
* an existing valid TTL (max-age or s-maxage). Setting a TTL of "0" means
* "always revalidate". The value of `defaultTtl` cannot be set to a value
* greater than that of `maxTtl`. When the `cacheMode` is set to
* `FORCE_CACHE_ALL`, the `defaultTtl` will overwrite the TTL set in all
* responses. The maximum allowed value is 31,622,400s (1 year). Infrequently
* accessed objects may be evicted from the cache before the defined TTL. If
* not specified, Cloud CDN uses 3600s (1 hour) for `CACHE_ALL_STATIC` and
* `FORCE_CACHE_ALL` modes. Cannot be specified when `cacheMode` is
* `USE_ORIGIN_HEADERS`.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration default_ttl = 100253422;</code>
* @param \Google\Cloud\Compute\V1\Duration $var
* @return $this
*/
public function setDefaultTtl($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\Duration::class);
$this->default_ttl = $var;
return $this;
}
/**
* Specifies the maximum allowed TTL for cached content. Cache directives that
* attempt to set a max-age or s-maxage higher than this, or an Expires header
* more than `maxTtl` seconds in the future will be capped at the value of
* `maxTtl`, as if it were the value of an s-maxage Cache-Control directive.
* Headers sent to the client will not be modified. Setting a TTL of "0" means
* "always revalidate". The maximum allowed value is 31,622,400s (1 year).
* Infrequently accessed objects may be evicted from the cache before the
* defined TTL. If not specified, Cloud CDN uses 86400s (1 day) for
* `CACHE_ALL_STATIC` mode. Can be specified only for `CACHE_ALL_STATIC` cache
* mode.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration max_ttl = 307578001;</code>
* @return \Google\Cloud\Compute\V1\Duration|null
*/
public function getMaxTtl()
{
return $this->max_ttl;
}
public function hasMaxTtl()
{
return isset($this->max_ttl);
}
public function clearMaxTtl()
{
unset($this->max_ttl);
}
/**
* Specifies the maximum allowed TTL for cached content. Cache directives that
* attempt to set a max-age or s-maxage higher than this, or an Expires header
* more than `maxTtl` seconds in the future will be capped at the value of
* `maxTtl`, as if it were the value of an s-maxage Cache-Control directive.
* Headers sent to the client will not be modified. Setting a TTL of "0" means
* "always revalidate". The maximum allowed value is 31,622,400s (1 year).
* Infrequently accessed objects may be evicted from the cache before the
* defined TTL. If not specified, Cloud CDN uses 86400s (1 day) for
* `CACHE_ALL_STATIC` mode. Can be specified only for `CACHE_ALL_STATIC` cache
* mode.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration max_ttl = 307578001;</code>
* @param \Google\Cloud\Compute\V1\Duration $var
* @return $this
*/
public function setMaxTtl($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\Duration::class);
$this->max_ttl = $var;
return $this;
}
/**
* 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.
*
* Generated from protobuf field <code>optional bool negative_caching = 336110005;</code>
* @return bool
*/
public function getNegativeCaching()
{
return isset($this->negative_caching) ? $this->negative_caching : false;
}
public function hasNegativeCaching()
{
return isset($this->negative_caching);
}
public function clearNegativeCaching()
{
unset($this->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.
*
* Generated from protobuf field <code>optional bool negative_caching = 336110005;</code>
* @param bool $var
* @return $this
*/
public function setNegativeCaching($var)
{
GPBUtil::checkBool($var);
$this->negative_caching = $var;
return $this;
}
/**
* 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.
*
* Generated from protobuf field <code>repeated .google.cloud.compute.v1.CachePolicyNegativeCachingPolicy negative_caching_policy = 155359996;</code>
* @return RepeatedField<\Google\Cloud\Compute\V1\CachePolicyNegativeCachingPolicy>
*/
public function getNegativeCachingPolicy()
{
return $this->negative_caching_policy;
}
/**
* 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.
*
* Generated from protobuf field <code>repeated .google.cloud.compute.v1.CachePolicyNegativeCachingPolicy negative_caching_policy = 155359996;</code>
* @param \Google\Cloud\Compute\V1\CachePolicyNegativeCachingPolicy[] $var
* @return $this
*/
public function setNegativeCachingPolicy($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Compute\V1\CachePolicyNegativeCachingPolicy::class);
$this->negative_caching_policy = $arr;
return $this;
}
/**
* 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.
*
* Generated from protobuf field <code>optional bool request_coalescing = 532808276;</code>
* @return bool
*/
public function getRequestCoalescing()
{
return isset($this->request_coalescing) ? $this->request_coalescing : false;
}
public function hasRequestCoalescing()
{
return isset($this->request_coalescing);
}
public function clearRequestCoalescing()
{
unset($this->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.
*
* Generated from protobuf field <code>optional bool request_coalescing = 532808276;</code>
* @param bool $var
* @return $this
*/
public function setRequestCoalescing($var)
{
GPBUtil::checkBool($var);
$this->request_coalescing = $var;
return $this;
}
/**
* Serve existing content from the cache (if available) when revalidating
* content with the origin, or when an error is encountered when refreshing
* the cache.
* This setting defines the default "max-stale" duration for any cached
* responses that do not specify a max-stale directive. Stale responses that
* exceed the TTL configured here will not be served. The default limit
* (max-stale) is 86400s (1 day), which will allow stale content to be
* served up to this limit beyond the max-age (or s-maxage) of a cached
* response.
* The maximum allowed value is 604800 (1 week).
* Set this to zero (0) to disable serve-while-stale.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration serve_while_stale = 236682203;</code>
* @return \Google\Cloud\Compute\V1\Duration|null
*/
public function getServeWhileStale()
{
return $this->serve_while_stale;
}
public function hasServeWhileStale()
{
return isset($this->serve_while_stale);
}
public function clearServeWhileStale()
{
unset($this->serve_while_stale);
}
/**
* Serve existing content from the cache (if available) when revalidating
* content with the origin, or when an error is encountered when refreshing
* the cache.
* This setting defines the default "max-stale" duration for any cached
* responses that do not specify a max-stale directive. Stale responses that
* exceed the TTL configured here will not be served. The default limit
* (max-stale) is 86400s (1 day), which will allow stale content to be
* served up to this limit beyond the max-age (or s-maxage) of a cached
* response.
* The maximum allowed value is 604800 (1 week).
* Set this to zero (0) to disable serve-while-stale.
*
* Generated from protobuf field <code>optional .google.cloud.compute.v1.Duration serve_while_stale = 236682203;</code>
* @param \Google\Cloud\Compute\V1\Duration $var
* @return $this
*/
public function setServeWhileStale($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\Duration::class);
$this->serve_while_stale = $var;
return $this;
}
}