You are here

public static function HttpHelper::cachedRequestGetCid in Helper 7

1 call to HttpHelper::cachedRequestGetCid()
HttpHelper::cachedRequest in lib/HttpHelper.php

File

lib/HttpHelper.php, line 34

Class

HttpHelper

Code

public static function cachedRequestGetCid($url, array $options) {
  if (isset($options['cache']) && $options['cache'] === FALSE) {
    return FALSE;
  }
  elseif (isset($options['method']) && !in_array($options['method'], array(
    'GET',
    'HEAD',
  ))) {

    // Only cache GET and HEAD methods.
    return FALSE;
  }
  elseif (isset($options['cache']['cid'])) {
    return $options['cache']['cid'];
  }
  $cid_parts = array(
    $url,
    serialize(array_diff_key($options, array(
      'cache' => '',
    ))),
  );
  return 'http-request:' . drupal_hash_base64(serialize($cid_parts));
}