Created
February 27, 2018 09:17
-
-
Save ericmorand/2e52ea8c0c8a862f079cd35f1cd3e354 to your computer and use it in GitHub Desktop.
Add cacheable dependency to Drupal 8 response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$response = new CacheableResponse($data); | |
$cache = new CacheableMetadata(); | |
$cache->setCacheMaxAge(...); | |
$cache->setCacheContexts(...); | |
$cache->setCacheTags(...); | |
$response->addCacheableDependency($cache); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment