Why Drupal changes the module (system table) bootstrap value after i set it with an SQL query? I need to run some hooks very early in the boostrap like enhanced_page_cache does.

I copied the same hook_update to set my module as available in Drupal bootstrap
and alter its weight.

/**
 * Ensure the weight of the module is pretty high.
 */
 function MYMODULE_update_7000() {
   // Make sure this module is available on bootstrap.
   db_update('system')
    -&gt;fields(array('bootstrap' =&gt; 1, 'weight' =&gt; 98))
    -&gt;condition('type', 'module')
    -&gt;condition('name', 'MYMODULE')
    -&gt;execute();
  }


After the update the values are there, but if the caches are cleared, the module's bootstrap value on system table reverts back to 0.

Why is this happening?

How does the Enhanced_page_cache module does it and keeps the value intact?

Do i forget something?

Thanks
ok got it,

in system.module there is a function called _system_update_bootstrap_status()

this function changes bootstrap value to '1' for all modules that implement one (or more) of the hooks: 'boot', 'exit', 'watchdog', 'language_init'

so i just needed to implement an empty hook_boot() and my module is present in bootstrap.