mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
30 lines
662 B
PHP
30 lines
662 B
PHP
|
<?php
|
||
|
|
||
|
namespace SilverStripe\Core\Manifest;
|
||
|
|
||
|
/**
|
||
|
* Same as ManifestCache_File, but stores the data as valid PHP which gets included to load
|
||
|
* This is a bit faster if you have an opcode cache installed, but slower otherwise
|
||
|
*/
|
||
|
class ManifestCache_File_PHP extends ManifestCache_File
|
||
|
{
|
||
|
function load($key)
|
||
|
{
|
||
|
global $loaded_manifest;
|
||
|
$loaded_manifest = null;
|
||
|
|
||
|
$file = $this->folder . '/cache_' . $key;
|
||
|
if (file_exists($file)) {
|
||
|
include $file;
|
||
|
}
|
||
|
|
||
|
return $loaded_manifest;
|
||
|
}
|
||
|
|
||
|
function save($data, $key)
|
||
|
{
|
||
|
$file = $this->folder . '/cache_' . $key;
|
||
|
file_put_contents($file, '<?php $loaded_manifest = ' . var_export($data, true) . ';');
|
||
|
}
|
||
|
}
|