<?php
include_once "vendor/autoload.php";
use Couchbase\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'));
-
-
Notifications
You must be signed in to change notification settings - Fork 0
⚡ PSR-6 and PSR-16 Couchbase cache
License
teodoroleckie/cache
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
⚡ PSR-6 and PSR-16 Couchbase cache
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published