function module_implements_write_cache

Writes the hook implementation cache.

See also

module_implements()

Related topics

1 call to module_implements_write_cache()
RequestCloseSubscriber::onTerminate in drupal/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php
Performs end of request tasks.

File

drupal/core/includes/module.inc, line 948
API for loading and interacting with Drupal modules.

Code

function module_implements_write_cache() {
  $implementations =& drupal_static('module_implements');

  // Check whether we need to write the cache. We do not want to cache hooks
  // which are only invoked on HTTP POST requests since these do not need to be
  // optimized as tightly, and not doing so keeps the cache entry smaller.
  if (isset($implementations['#write_cache']) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')) {
    unset($implementations['#write_cache']);
    cache('bootstrap')
      ->set('module_implements', $implementations);
  }
}