1. Go to this page and download the library: Download cachly-dev/sdk 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/ */
cachly-dev / sdk example snippets
use Cachly\CachlyClient;
$cache = new CachlyClient('redis://:[email protected]:6379');
// Set a value with TTL
$cache->set('user:42', ['name' => 'Alice', 'plan' => 'pro'], ttl: 300);
// Get a value
$user = $cache->get('user:42'); // ['name' => 'Alice', 'plan' => 'pro']
// Check existence
if ($cache->exists('user:42')) { ... }
// TTL refresh
$cache->expire('user:42', 600);
// Atomic counter
$count = $cache->incr('page:views');
// Delete
$cache->del('user:42');
// config/cachly.php
return ['url' => env('CACHLY_URL')];
// AppServiceProvider
$this->app->singleton(CachlyClient::class, fn() => new CachlyClient(config('cachly.url')));
// In a controller / service
public function __construct(private CachlyClient $cache) {}