You are here

function _restclient_generate_cid in RESTClient 7.2

Generate the cache id for a given request

Parameters

array $variables: Request variables

Return value

string|boolean Returns a unique string to be used as a cache id, FALSE otherwise.

1 call to _restclient_generate_cid()
_restclient_request in ./restclient.module
Basic request with no body data.

File

./restclient.module, line 742
Defines a standard REST interface to RESTful services

Code

function _restclient_generate_cid($method, $url, $headers) {
  $cid = '';
  if (empty($headers)) {
    $cid = $method . ':' . $url;
  }
  else {
    $cid = $method . ':' . $url . ':' . serialize($headers);
  }

  // Do not use drupal_strlen() here.
  if (strlen($cid) > 255) {
    $cid = $method . ':' . hash('sha512', $cid);
  }
  return $cid;
}