1. Go to this page and download the library: Download slick/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/ */
slick / cache example snippets
use Slick\Cache\Cache;
$cache = Cache::get();
$data = $cache->get('data', false);
if (!$data) {
$data = file_get_contents("http://www.example.com/api/call.json");
$cache->set('data', $data);
}
use Slick\Cache\Cache;
$cache = Cache::get();
$data = $cache->get('data', false);
if (!$data) {
$data = file_get_contents("http://www.example.com/api/call.json");
// Set expire to 3 minutes
$cache->set('data', $data, 3*60);
}
use Slick\Cache\Cache;
$cache = Cache::get();
// Set global cache expire to 10 minutes
$cache->duration = 10*60;
$data = $cache->get('data', false);
if (!$data) {
$data = file_get_contents("http://www.example.com/api/call.json");
// This will use the 10 minutes setting from above
$cache->set('data', $data);
}
public DriverInterface DriverInterface::set(string $key, mixed $value [, int $expire = -1])
public mixed DriverInterface::get(string $key [, mixed $default = false])
public DriverInterface DriverInterface::erase(string $key)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.