public function FeedsHTTPCacheItem::__construct in Feeds 7.2
FeedsHTTPCacheItem object constructor.
Parameters
string $cid: The cache ID.
object $response: The HTTP response object.
File
- includes/
FeedsHTTPCacheItem.inc, line 49 - Contains FeedsHTTPCacheItem class.
Class
- FeedsHTTPCacheItem
- Class of a cached item.
Code
public function __construct($cid, $response) {
$this
->setCid($cid);
// Copy over other metadata from result, but not the raw data.
// Value is assigned by reference to save memory.
foreach ($response as $key => &$value) {
switch ($key) {
case 'headers':
$this->headers = (array) $value;
break;
case 'file_path':
$this
->setFilePath($value);
break;
case 'data':
// Data should not be cached in the database, so save data to a file
// instead. The whole response object is passed to save memory usage.
// The data could potentially be huge.
$this
->saveResponseData($response);
break;
default:
$this->{$key} = $response->{$key};
}
}
}