1. Go to this page and download the library: Download sci/cacheable 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/ */
sci / cacheable example snippets
class Foo
{
public function bar($a, $b)
{
// make some hard things with $a and $b
...
return ...; // some result
}
}
$foo = new Foo();
$bar = $foo->bar(1, 2); // takes some amount of time
// and later, again...
$bar = $foo->bar(1, 2); // takes the same amount of time, again
use Sci\Cacheable;
use Sci\CacheTrait;
class Foo implements Cacheable
{
use CacheTrait;
public function bar($a, $b)
{
// make some hard things with $a and $b
...
return ...; // some result
}
}
$foo = new Foo();
$foo->setCache(/* any PSR-6 cache pool interface */)
$bar = $foo->cache()->bar(1, 2); // 1st call takes some time, but now, the result is stored into cache
// and later, again...
$bar = $foo->cache()->bar(1, 2); // 2nd call's result comes directly from cache
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.