penate/client

Client for key-value storage Penate

dev-master 2019-01-14 22:37 UTC

This package is not auto-updated.

Last update: 2024-11-12 00:49:20 UTC


README

Simple client for working with PenadeDB using Guzzle

Installation

$ composer require penate/client

Usage

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]

You can also set temporary values.

$penate->setItem('temporaryValue', 'Hello', 1);

$penate->getItem('temporaryValue'); // Hello

sleep(120); // after 2 minutes

$penate->getItem('temporaryValue'); // null