You are here

function restclient_cache_set in RESTClient 7.2

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

File

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

Code

function restclient_cache_set($variables, $cid, $data) {
  $expires = 1;
  if (!empty($data->headers['expires']) and !$variables['cache_default_override']) {
    $expires = strtotime($data->headers['expires']);
    if (!is_int($expires)) {
      $expires = 1;
    }
  }
  if ($variables['cache_default_override']) {
    $expires = time() + $variables['cache_default_time'];
  }
  if (isset($variables['stale_cache']) and $variables['stale_cache']) {
    $data->stale_cache = $expires;
    $expires = CACHE_PERMANENT;
  }
  return cache_set($cid, $data, 'cache_restclient', $expires);
}