Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Cache/RefinableCacheableDependencyInterface.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Core\Cache; | |
4 | |
5 /** | |
6 * Allows to add cacheability metadata to an object for the current runtime. | |
7 * | |
8 * This must be used when changing an object in a way that affects its | |
9 * cacheability. For example, when changing the active translation of an entity | |
10 * based on the current content language then a cache context for that must be | |
11 * added. | |
12 */ | |
13 interface RefinableCacheableDependencyInterface extends CacheableDependencyInterface { | |
14 | |
15 /** | |
16 * Adds cache contexts. | |
17 * | |
18 * @param string[] $cache_contexts | |
19 * The cache contexts to be added. | |
20 * | |
21 * @return $this | |
22 */ | |
23 public function addCacheContexts(array $cache_contexts); | |
24 | |
25 /** | |
26 * Adds cache tags. | |
27 * | |
28 * @param string[] $cache_tags | |
29 * The cache tags to be added. | |
30 * | |
31 * @return $this | |
32 */ | |
33 public function addCacheTags(array $cache_tags); | |
34 | |
35 /** | |
36 * Merges the maximum age (in seconds) with the existing maximum age. | |
37 * | |
38 * The max age will be set to the given value if it is lower than the existing | |
39 * value. | |
40 * | |
41 * @param int $max_age | |
42 * The max age to associate. | |
43 * | |
44 * @return $this | |
45 * | |
46 * @throws \InvalidArgumentException | |
47 * Thrown if a non-integer value is supplied. | |
48 */ | |
49 public function mergeCacheMaxAge($max_age); | |
50 | |
51 /** | |
52 * Adds a dependency on an object: merges its cacheability metadata. | |
53 * | |
54 * @param \Drupal\Core\Cache\CacheableDependencyInterface|object $other_object | |
55 * The dependency. If the object implements CacheableDependencyInterface, | |
56 * then its cacheability metadata will be used. Otherwise, the passed in | |
57 * object must be assumed to be uncacheable, so max-age 0 is set. | |
58 * | |
59 * @return $this | |
60 * | |
61 * @see \Drupal\Core\Cache\CacheableMetadata::createFromObject() | |
62 */ | |
63 public function addCacheableDependency($other_object); | |
64 | |
65 } |