1. Go to this page and download the library: Download ryanhellyer/stale-cache library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ryanhellyer / stale-cache example snippets
use RyanHellyer\StaleCache\StaleCache;
$data = StaleCache::get(
'my_cache_key',
[5, 3600], // [stale_time, cache_duration, lock_duration (optional)]
function () {
return get_expensive_data();
}
);
interface CacheStore
{
public function get(string $key): mixed;
public function set(string $key, mixed $value, int $ttl): bool;
public function delete(string $key): bool;
}
interface HookManager
{
public function onShutdown(callable $callback): void;
}
[stale_time, cache_duration, lock_duration]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.