protected function FileSystemBackend::getFile in File Cache 8
Returns the raw, unprepared cache item from the given file.
Parameters
string $filename: The path or stream wrapper URI of the file to load.
Return value
object|null The raw, unprepared cache item or NULL if the file does not exist or does not contain a serialized cache item.
3 calls to FileSystemBackend::getFile()
- FileSystemBackend::garbageCollection in src/
Cache/ FileSystemBackend.php - Performs garbage collection on a cache bin.
- FileSystemBackend::get in src/
Cache/ FileSystemBackend.php - Returns data from the persistent cache.
- FileSystemBackend::invalidateAll in src/
Cache/ FileSystemBackend.php - Marks all cache items as invalid.
File
- src/
Cache/ FileSystemBackend.php, line 407
Class
- FileSystemBackend
- A cache backend that stores cache items as files on the file system.
Namespace
Drupal\filecache\CacheCode
protected function getFile($filename) {
if (is_file($filename)) {
$serialized_contents = file_get_contents($filename);
if ($serialized_contents !== FALSE) {
$item = unserialize($serialized_contents);
// Only return the item if it could be successfully deserialized.
if ($item !== FALSE) {
return $item;
}
}
}
return NULL;
}