18 lines
519 B
PHP
18 lines
519 B
PHP
<?php
|
|
// V93 cached wrapper - fixes 8sec psql queries
|
|
header('Content-Type: application/json');
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('X-V93-cache: 60s-wrapper');
|
|
$cache = '/tmp/visual-management-data.cache.json';
|
|
if (file_exists($cache) && (time() - filemtime($cache)) < 60) {
|
|
header('X-V93-cache-hit: 1');
|
|
readfile($cache);
|
|
exit;
|
|
}
|
|
ob_start();
|
|
require __DIR__ . '/visual-management-live.php';
|
|
$body = ob_get_clean();
|
|
@file_put_contents($cache, $body);
|
|
header('X-V93-cache-hit: 0');
|
|
echo $body;
|