1. Go to this page and download the library: Download solophp/file-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/ */
solophp / file-cache example snippets
use Solo\FileCache;
$cache = new FileCache('/path/to/cache');
// Set a cache item with a 1-hour TTL
$cache->set('user_123', ['name' => 'John Doe'], 3600);
// Retrieve the cache item
$user = $cache->get('user_123', null);
if ($user !== null) {
echo $user['name']; // Outputs: John Doe
}
// Check if a cache item exists
if ($cache->has('user_123')) {
echo 'Cache exists!';
}
// Delete a cache item
$cache->delete('user_123');
// Clear all cache items
$cache->clear();