penate / client
Penate 的键值存储客户端
dev-master
2019-01-14 22:37 UTC
Requires
- php: ^7.2.0
- ext-json: *
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpunit/phpunit: ~7.0
This package is not auto-updated.
Last update: 2024-09-17 00:06:13 UTC
README
使用 Guzzle 操作 PenadeDB 的简单客户端
安装
$ composer require penate/client
使用方法
use Penate\Client\PenateClient; $penate = new PenateClient('http://localhost:8000'); // Write and read $penate->setItem('code', 100); // 100 $penate->getItem('code'); // 100 // Operations $penate->increment('code'); // 101 $penate->decrement('code'); // 100 //Mass call $penate->setItem('val1', 10); $penate->setItem('val2', 20); $penate->getItems(['val1', 'val2']); // [10,20]
您也可以设置临时值。
$penate->setItem('temporaryValue', 'Hello', 1); $penate->getItem('temporaryValue'); // Hello sleep(120); // after 2 minutes $penate->getItem('temporaryValue'); // null