I secured some file in an s3 bucket using s3fs. My problem is : the "Expires" argument send to build the file URI is not reset each time the object is call in my API.
time doesn't change if I don't clear the cache with drush
$expires = time() + 10;
So I tried to use hook_entity_view :
if ($entity->bundle() === 'my_bundle') {
foreach ($entity->getCacheTags() as $tag) {
$tags[] = $tag;
}
}
Doesn't work
Drupal::entityTypeManager()->getStorage($entityType)->resetCache();
Nop
\Drupal::service('cache.render')->deleteAll();
\Drupal::service('cache.entity')->deleteAll();
\Drupal::service('cache.data')->deleteAll();
deleteAll or invalidateAll, none of it work.
drupal_flush_all_caches();
Nothing, I'm starting to think I have config problem... If someone can save me !
UPDATE
It seems hook_entity_load works with my API, it clear the cache correctly. The problem remains when i'm trying to watch the content in my Drupal website, in the content view.
my_bundle
? Then see drupal.stackexchange.com/questions/232607/… – 4k4 Oct 9 '20 at 11:22