As usual, I am debugging something and this time, it's jsonapi. I already have $settings['cache']['bins']['render'] = 'cache.backend.null';
and $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
this works for HTML, how do you force JSONAPI to not cache?
-
1Does this answer your question? Drupal 8 caches Rest API Calls– leymannxCommented Mar 17, 2020 at 9:39
-
1Unlikely this has something to do with HTML/JSON, but you need to disable 3 cache bins now, see drupal.stackexchange.com/questions/248194/…– 4uk4Commented Mar 17, 2020 at 10:52
-
@leymannx no, it does not, and it is not helpful at all, in fact that should be closed in favor of this one because that one predates drupal.org/node/2896679 which was my problem. It's very likely I was not bitten by the separate page cache bin normally because I am typically logged in the browser.– ̷c̷h̷x̷Commented Mar 18, 2020 at 0:06
Add a comment
|
1 Answer
This is due to the internal page cache and Internal dynamic page cache, Drupal will heavily cache all GET requests, so what you are missing is
$settings['cache']['bins']['page'] = 'cache.backend.null';
as the 3rd bin to clear but this won't work due to dynamic cache, so can you either manually purge the entire Drupal cache or set a timestamp into your URL so you can bypass caching for development.
node/1?_format=json&time=123456789
-
2AH. The reason for confusion lies in "Disable the render cache (this includes the page cache)." the
(this includes the page cache)
part was added in drupal.org/i/606840 very very long ago tosites/example.settings.local.php
and removed in drupal.org/i/2921706 in 2018 January and my settings.local.php significantly predates that.– ̷c̷h̷x̷Commented Mar 18, 2020 at 0:04