rosavox/source/helpers/cache.php

31 lines
330 B
PHP
Raw Normal View History

2025-05-22 06:26:16 +00:00
<?php
namespace rosavox\helpers\cache;
/**
*/
class state
{
public static array $pool = [];
}
/**
*/
function get(string $key, \Closure $retrieve)
{
if (\array_key_exists($key, state::$pool))
{
$value = state::$pool[$key];
}
else
{
$value = ($retrieve)();
state::$pool[$key] = $value;
}
return $value;
}
?>