2

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?

3
  • 1
    Does this answer your question? Drupal 8 caches Rest API Calls
    – leymannx
    Commented Mar 17, 2020 at 9:39
  • 1
    Unlikely this has something to do with HTML/JSON, but you need to disable 3 cache bins now, see drupal.stackexchange.com/questions/248194/…
    – 4uk4
    Commented 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. Commented Mar 18, 2020 at 0:06

1 Answer 1

3

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
1
  • 2
    AH. 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 to sites/example.settings.local.php and removed in drupal.org/i/2921706 in 2018 January and my settings.local.php significantly predates that. Commented Mar 18, 2020 at 0:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.