Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Core/Cache/RefinableCacheableDependencyInterface.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Core\Cache; |
Chris@0 | 4 |
Chris@0 | 5 /** |
Chris@0 | 6 * Allows to add cacheability metadata to an object for the current runtime. |
Chris@0 | 7 * |
Chris@0 | 8 * This must be used when changing an object in a way that affects its |
Chris@0 | 9 * cacheability. For example, when changing the active translation of an entity |
Chris@0 | 10 * based on the current content language then a cache context for that must be |
Chris@0 | 11 * added. |
Chris@0 | 12 */ |
Chris@0 | 13 interface RefinableCacheableDependencyInterface extends CacheableDependencyInterface { |
Chris@0 | 14 |
Chris@0 | 15 /** |
Chris@0 | 16 * Adds cache contexts. |
Chris@0 | 17 * |
Chris@0 | 18 * @param string[] $cache_contexts |
Chris@0 | 19 * The cache contexts to be added. |
Chris@0 | 20 * |
Chris@0 | 21 * @return $this |
Chris@0 | 22 */ |
Chris@0 | 23 public function addCacheContexts(array $cache_contexts); |
Chris@0 | 24 |
Chris@0 | 25 /** |
Chris@0 | 26 * Adds cache tags. |
Chris@0 | 27 * |
Chris@0 | 28 * @param string[] $cache_tags |
Chris@0 | 29 * The cache tags to be added. |
Chris@0 | 30 * |
Chris@0 | 31 * @return $this |
Chris@0 | 32 */ |
Chris@0 | 33 public function addCacheTags(array $cache_tags); |
Chris@0 | 34 |
Chris@0 | 35 /** |
Chris@0 | 36 * Merges the maximum age (in seconds) with the existing maximum age. |
Chris@0 | 37 * |
Chris@0 | 38 * The max age will be set to the given value if it is lower than the existing |
Chris@0 | 39 * value. |
Chris@0 | 40 * |
Chris@0 | 41 * @param int $max_age |
Chris@0 | 42 * The max age to associate. |
Chris@0 | 43 * |
Chris@0 | 44 * @return $this |
Chris@0 | 45 * |
Chris@0 | 46 * @throws \InvalidArgumentException |
Chris@0 | 47 * Thrown if a non-integer value is supplied. |
Chris@0 | 48 */ |
Chris@0 | 49 public function mergeCacheMaxAge($max_age); |
Chris@0 | 50 |
Chris@0 | 51 /** |
Chris@0 | 52 * Adds a dependency on an object: merges its cacheability metadata. |
Chris@0 | 53 * |
Chris@0 | 54 * @param \Drupal\Core\Cache\CacheableDependencyInterface|object $other_object |
Chris@0 | 55 * The dependency. If the object implements CacheableDependencyInterface, |
Chris@0 | 56 * then its cacheability metadata will be used. Otherwise, the passed in |
Chris@0 | 57 * object must be assumed to be uncacheable, so max-age 0 is set. |
Chris@0 | 58 * |
Chris@0 | 59 * @return $this |
Chris@0 | 60 * |
Chris@0 | 61 * @see \Drupal\Core\Cache\CacheableMetadata::createFromObject() |
Chris@0 | 62 */ |
Chris@0 | 63 public function addCacheableDependency($other_object); |
Chris@0 | 64 |
Chris@0 | 65 } |