PenateDB is an open source, in-memory key-value storage written in PHP. There already many php-based in-memory database implementation whether it’s SQL based or NoSQL based, however their applications remain limited to small or embedded PHP applications for example.

PenateDB came as server and client, sample usage of the 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]

You can also set temporary values such as :

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

sleep(120); // after 2 minutes

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

Most interesting hidden feature in this in-memory database is its name, which remind me PentaDB a very old engine model produced in 1929 and which was used by passenger cars and taxi cabs between 1929 and 1958. In a very similar way, PenateDB could be embedded in any PHP applications to provide in-memory key-value datastore for caching or storing data.

More information at https://github.com/PenateDB

LEAVE A REPLY

Please enter your comment!
Please enter your name here