Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Cache/CacheableResponseInterface.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 * Defines an interface for responses that can expose cacheability metadata. | |
7 * | |
8 * @see \Drupal\Core\Cache\CacheableResponseTrait | |
9 */ | |
10 interface CacheableResponseInterface { | |
11 | |
12 /** | |
13 * Adds a dependency on an object: merges its cacheability metadata. | |
14 * | |
15 * For instance, when a response depends on some configuration, an entity, or | |
16 * an access result, we must make sure their cacheability metadata is present | |
17 * on the response. This method makes doing that simple. | |
18 * | |
19 * @param \Drupal\Core\Cache\CacheableDependencyInterface|mixed $dependency | |
20 * The dependency. If the object implements CacheableDependencyInterface, | |
21 * then its cacheability metadata will be used. Otherwise, the passed in | |
22 * object must be assumed to be uncacheable, so max-age 0 is set. | |
23 * | |
24 * @return $this | |
25 * | |
26 * @see \Drupal\Core\Cache\CacheableMetadata::createFromObject() | |
27 */ | |
28 public function addCacheableDependency($dependency); | |
29 | |
30 /** | |
31 * Returns the cacheability metadata for this response. | |
32 * | |
33 * @return \Drupal\Core\Cache\CacheableMetadata | |
34 */ | |
35 public function getCacheableMetadata(); | |
36 | |
37 } |