HTTP Request Cache

Component ID

2459417

Component name

HTTP Request Cache

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

418

Component created

Component changed

Component body

Provides a wrapper around drupal_http_request() that will, by default, cache outgoing GET requests. Also defines an alter hook so that other modules can adjust if a request is cached or not.

Requirements

No additional requirements.

Usage

Just enable the module and it will start caching outgoing GET requests. More complex rules require implementing an alter hook.

hook usage

/**
 * Implements hook_http_request_is_cacheable_alter().
 */
function MYMODULE_http_request_is_cacheable_alter(&$is_cacheable, $context) {
 
  // Try and limit to only Solr requests to minimize possible issues.
  $is_cacheable &= strpos($context['url'], '/solr/') !== FALSE;
}