CacheKeyPolicy.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?php
  2. /*
  3. * Copyright 2014 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  6. * use this file except in compliance with the License. You may obtain a copy of
  7. * the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations under
  15. * the License.
  16. */
  17. namespace Google\Service\Compute;
  18. class CacheKeyPolicy extends \Google\Collection
  19. {
  20. protected $collection_key = 'queryStringWhitelist';
  21. /**
  22. * If true, requests to different hosts will be cached separately.
  23. *
  24. * @var bool
  25. */
  26. public $includeHost;
  27. /**
  28. * Allows HTTP request headers (by name) to be used in the cache key.
  29. *
  30. * @var string[]
  31. */
  32. public $includeHttpHeaders;
  33. /**
  34. * Allows HTTP cookies (by name) to be used in the cache key. The name=value
  35. * pair will be used in the cache key Cloud CDN generates.
  36. *
  37. * @var string[]
  38. */
  39. public $includeNamedCookies;
  40. /**
  41. * If true, http and https requests will be cached separately.
  42. *
  43. * @var bool
  44. */
  45. public $includeProtocol;
  46. /**
  47. * If true, include query string parameters in the cache key according to
  48. * query_string_whitelist and query_string_blacklist. If neither is set, the
  49. * entire query string will be included. If false, the query string will be
  50. * excluded from the cache key entirely.
  51. *
  52. * @var bool
  53. */
  54. public $includeQueryString;
  55. /**
  56. * Names of query string parameters to exclude in cache keys. All other
  57. * parameters will be included. Either specify query_string_whitelist or
  58. * query_string_blacklist, not both. '&' and '=' will be percent encoded and
  59. * not treated as delimiters.
  60. *
  61. * @var string[]
  62. */
  63. public $queryStringBlacklist;
  64. /**
  65. * Names of query string parameters to include in cache keys. All other
  66. * parameters will be excluded. Either specify query_string_whitelist or
  67. * query_string_blacklist, not both. '&' and '=' will be percent encoded and
  68. * not treated as delimiters.
  69. *
  70. * @var string[]
  71. */
  72. public $queryStringWhitelist;
  73. /**
  74. * If true, requests to different hosts will be cached separately.
  75. *
  76. * @param bool $includeHost
  77. */
  78. public function setIncludeHost($includeHost)
  79. {
  80. $this->includeHost = $includeHost;
  81. }
  82. /**
  83. * @return bool
  84. */
  85. public function getIncludeHost()
  86. {
  87. return $this->includeHost;
  88. }
  89. /**
  90. * Allows HTTP request headers (by name) to be used in the cache key.
  91. *
  92. * @param string[] $includeHttpHeaders
  93. */
  94. public function setIncludeHttpHeaders($includeHttpHeaders)
  95. {
  96. $this->includeHttpHeaders = $includeHttpHeaders;
  97. }
  98. /**
  99. * @return string[]
  100. */
  101. public function getIncludeHttpHeaders()
  102. {
  103. return $this->includeHttpHeaders;
  104. }
  105. /**
  106. * Allows HTTP cookies (by name) to be used in the cache key. The name=value
  107. * pair will be used in the cache key Cloud CDN generates.
  108. *
  109. * @param string[] $includeNamedCookies
  110. */
  111. public function setIncludeNamedCookies($includeNamedCookies)
  112. {
  113. $this->includeNamedCookies = $includeNamedCookies;
  114. }
  115. /**
  116. * @return string[]
  117. */
  118. public function getIncludeNamedCookies()
  119. {
  120. return $this->includeNamedCookies;
  121. }
  122. /**
  123. * If true, http and https requests will be cached separately.
  124. *
  125. * @param bool $includeProtocol
  126. */
  127. public function setIncludeProtocol($includeProtocol)
  128. {
  129. $this->includeProtocol = $includeProtocol;
  130. }
  131. /**
  132. * @return bool
  133. */
  134. public function getIncludeProtocol()
  135. {
  136. return $this->includeProtocol;
  137. }
  138. /**
  139. * If true, include query string parameters in the cache key according to
  140. * query_string_whitelist and query_string_blacklist. If neither is set, the
  141. * entire query string will be included. If false, the query string will be
  142. * excluded from the cache key entirely.
  143. *
  144. * @param bool $includeQueryString
  145. */
  146. public function setIncludeQueryString($includeQueryString)
  147. {
  148. $this->includeQueryString = $includeQueryString;
  149. }
  150. /**
  151. * @return bool
  152. */
  153. public function getIncludeQueryString()
  154. {
  155. return $this->includeQueryString;
  156. }
  157. /**
  158. * Names of query string parameters to exclude in cache keys. All other
  159. * parameters will be included. Either specify query_string_whitelist or
  160. * query_string_blacklist, not both. '&' and '=' will be percent encoded and
  161. * not treated as delimiters.
  162. *
  163. * @param string[] $queryStringBlacklist
  164. */
  165. public function setQueryStringBlacklist($queryStringBlacklist)
  166. {
  167. $this->queryStringBlacklist = $queryStringBlacklist;
  168. }
  169. /**
  170. * @return string[]
  171. */
  172. public function getQueryStringBlacklist()
  173. {
  174. return $this->queryStringBlacklist;
  175. }
  176. /**
  177. * Names of query string parameters to include in cache keys. All other
  178. * parameters will be excluded. Either specify query_string_whitelist or
  179. * query_string_blacklist, not both. '&' and '=' will be percent encoded and
  180. * not treated as delimiters.
  181. *
  182. * @param string[] $queryStringWhitelist
  183. */
  184. public function setQueryStringWhitelist($queryStringWhitelist)
  185. {
  186. $this->queryStringWhitelist = $queryStringWhitelist;
  187. }
  188. /**
  189. * @return string[]
  190. */
  191. public function getQueryStringWhitelist()
  192. {
  193. return $this->queryStringWhitelist;
  194. }
  195. }
  196. // Adding a class alias for backwards compatibility with the previous class name.
  197. class_alias(CacheKeyPolicy::class, 'Google_Service_Compute_CacheKeyPolicy');