0

I have a D8 module that works well. But I have a problem. Sensors data are stored in a database. In the D8 website, the cache is disabled, but the selected data are not updated. If I use the "drush cr" then ok, but the next selected data are not updated. What may be the problem? The code shortly:

#
# form for SQL SELECT
#
function buildForm()
//...
$form['date_from'] = [ '#type' => 'datetime', ... ];
$form['date_to'] = ...
$form['#cache'] = ['max-age' => 0];
/// ...

So, I select a date_from and date_to and post it then it is ok. I go back and change the date_from, date_to and post it then it still stay the previous date! After "drush cr" it works once again... and so on

It has no effect (settings.php): $settings['rebuild_access'] = TRUE;

Thanks, G.

gabor
  • 53
  • 5

1 Answers1

0

I found it: How to clear cache programmatically in Drupal 8?

Both work. :)

in function buildForm():

drupal_flush_all_caches();
// or
\Drupal::service("router.builder")->rebuild();
gabor
  • 53
  • 5