Cache::set()
Create a new cache file.
Cache::set(string $id, callable $fn, array $lot = []): array;
Example:
$A = Cache::set('foo', function() {
return date('Y-m-d H:i:s');
});
$B = Cache::set('.\lot\path\to\file.php', function($file) {
ob_start();
require $file;
return ob_get_clean();
});
Result:
$A = ['2019-02-17 21:47:18', '.\lot\cache\8c736521.php', 1549080564];
$B = ['2019-02-17 21:47:18', '.\lot\cache\path\to\file.php.php', 1549080564];
Note: If
$id
is identified as a valid file, then the generated cache path will be structured like this:.\lot\foo\bar\baz.txt → .\lot\cache\foo\bar\baz.txt.php