protected function FeedsHTTPCacheTest::createCacheRecord in Feeds 7.2
Creates a cache record, bypassing the API.
Parameters
string $cid: (optional) The cache item ID.
object $response: (optional) The response to save.
Return value
string The cache item ID.
3 calls to FeedsHTTPCacheTest::createCacheRecord()
- FeedsHTTPCacheTest::testGet in tests/
FeedsHTTPCacheTest.test - @covers FeedsHTTPCache::get().
- FeedsHTTPCacheTest::testGetMultiple in tests/
FeedsHTTPCacheTest.test - @covers FeedsHTTPCache::getMultiple().
- FeedsHTTPCacheTest::testIsEmpty in tests/
FeedsHTTPCacheTest.test - @covers FeedsHTTPCache::isEmpty().
File
- tests/
FeedsHTTPCacheTest.test, line 78
Class
- FeedsHTTPCacheTest
- @coversDefaultClass FeedsHTTPCache @group feeds
Code
protected function createCacheRecord($cid = NULL, $response = NULL) {
if (empty($cid)) {
$cid = static::randomName();
}
if (empty($response)) {
$response = $this
->createHttpResponse(FALSE);
$response->file_path = static::FEEDS_CACHE_DIR . '/' . $cid;
}
$record = new stdClass();
$record->cid = $cid;
$record->data = serialize($response);
$record->expire = CACHE_PERMANENT;
$record->created = REQUEST_TIME;
$record->serialized = TRUE;
drupal_write_record('cache_feeds_http', $record);
return $cid;
}