more typing

This commit is contained in:
Shish
2024-01-19 18:33:32 +00:00
parent 6bde7457e7
commit 448e270da8
3 changed files with 38 additions and 13 deletions

View File

@@ -804,6 +804,12 @@ function stringer(mixed $s): string
/**
* If a value is in the cache, return it; otherwise, call the callback
* to generate it and store it in the cache.
*
* @template T
* @param string $key
* @param callable():T $callback
* @param int|null $ttl
* @return T
*/
function cache_get_or_set(string $key, callable $callback, ?int $ttl = null): mixed
{