1. Go to this page and download the library: Download tleckie/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/ */
tleckie / cache example snippets
ouchbase\Cluster;
use Couchbase\ClusterOptions;
use Tleckie\Cache\Couchbase\Client;
use Tleckie\Cache\Couchbase\Psr16\Psr16Cache;
use Tleckie\Cache\Couchbase\Psr6\Item;
use Tleckie\Cache\Couchbase\Psr6\Pool;
$options = new ClusterOptions();
$options->credentials("user", "pass");
$client = new Client(new Cluster("couchbase://localhost/", $options), 'bucketName');
//psr6
$pool = new Pool($client);
$item = new Item('item.key');
$item->set(['name'=> 'My Name', 'age' => 32]);
$item->expiresAt(3600);
$pool->save($item);
$item = $pool->getItem('item.key');
var_dump($item);
var_dump($item->get());
var_dump($item->isHit());
//psr16
$cache = new Psr16Cache($client);
$cache->set(
'key',
['name'=> 'My Name', 'age' => 32],
3600
);
var_dump($cache->get('key'));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.