PHP code example of aellopus / client

1. Go to this page and download the library: Download aellopus/client 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/ */

    

aellopus / client example snippets


use Aellopus\Client\Client;
use Aellopus\Client\Exception\NotFoundError;

$client = Client::connect('127.0.0.1:6969'); // timeoutMs defaults to 5000

$client->set('user:1', 'John');
echo $client->get('user:1');                 // "John"

try {
    $client->get('absent');
} catch (NotFoundError) {
    // a miss is distinct from an empty value
}

$client->set('counter', '0');
$client->incr('counter');                     // 1

// Lazily walk the keyspace:
foreach ($client->scan('user:*') as $key) {
    echo $key, PHP_EOL;
}

$client->close();