I'm experiencing an interesting and odd situation with entity (field value) caching.
hook_ENTITY_TYPE_storage_load() to set the value of a field when nodes of a certain type are loaded. Per the documentation these alterations will be cached, which is what I want.
But also I want to invalidate/clear that cache at a different point in code. Per this answer to "How do I invalidate the cache of an entity?" I'm calling
$changed is the array of node IDs). This works for me locally: the storage load hook runs and I see my expected (newly updated, not cached) field value as loaded in the hook.
But on an Acquia Cloud environment, I don't see the updated value until I run the Admin Toolbar Tools' menu's "Flush plugins cache" option. Looking at the code for that link's controller callback, I see it running a
CachedDiscoveryClearerInterface instance's method
I don't think this is really an Acquia issue; just that our Acquia env happens to employ additional/different caching than on my local env. The confusing part is why cached plugin information would have any effect on the caching of an entity / its field value. (Inspecting the
cache_discovery database table, I see a bunch of structural things like field definitions and element info, in addition to plugin information.)
I'm hoping someone can explain what's being cached and why. For reference, I am checking my field value in a field widget on a node edit form - not the rendered node output.