Cache for logged-in user? I have created simple form and page to list records on form via Custom Drupal 8 Module. This form is accessible to only logged-in users with some specific role. It looks like screenshot. Whenever I submit new entry it lists record in via theme table for admin user but it does not appear for other logged-in users until I clear cache manually. 

Please suggest, Thanks!

To display Records : 

&lt;?php

namespace Drupal\custom_form\Controller;
use Drupal\Core\Controller\ControllerBase;

class DisplayRecords extends ControllerBase {

  public function DisplayCustomRecords() {

    // Display theme table

    $table_header = [
      'name' =&gt; t('Name'),
      'mobilenumber' =&gt; t('Phone Number'),
      'email' =&gt; t('Email'),
      'age' =&gt; t('Age'),
      'gender' =&gt; t('Gender')
    ];

    $results = \Drupal::database()-&gt;select('custom_for_data')
      -&gt;fields('custom_for_data', [
        'name',
        'mobilenumber',
        'email',
        'age',
        'gender'
      ])
      -&gt;execute()
      -&gt;fetchAll();

    $rows = array();
    foreach ($results as $res) {
      $formatted_age = \Drupal::service('date.formatter')-&gt;format(
        $res-&gt;age, 'custom', 'Y-m-d'
      );
      $rows[] = [
        'name' =&gt; $res-&gt;name,
        'mobilenumber' =&gt; $res-&gt;mobilenumber,
        'email' =&gt; $res-&gt;email,
        'age' =&gt; $formatted_age,
        'gender' =&gt; $res-&gt;gender
      ];
    }

    $form['table'] = [
      '#type' =&gt; 'table',
      '#header' =&gt; $table_header,
      '#rows' =&gt; $rows,
      '#empty' =&gt; t('No users found'),
    ];

    return $form;

  }


}
Short version: You need to define a cache tag that you can invalidate when a record is created, updated or deleted.

See https://www.drupal.org/docs/8/api/render-api/cacheability-of-render-arrays for a lot of documentation on this.

I'd also recommend to look into using an entity type for this instead of a custom table. A bit of effort at first, but you get a ton of functionality with that, including default cache tags and for example views integration, so you can build searchable, sortable listings like that through views.