PHP code example of kinetis / redis

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

    

kinetis / redis example snippets


use Kinetis\Redis\Client;
use Kinetis\Redis\ClientOptions;
use Kinetis\Redis\ClusterClient;
use Kinetis\Redis\Endpoint;

$client = Client::create(Endpoint::parse('127.0.0.1:6379'), new ClientOptions(timeout: 5.0));
$client->execute('SET', 'user.1', 'payload', 'EX', 60);

$cluster = ClusterClient::create(
    [Endpoint::parse('10.0.0.1:6379'), Endpoint::parse('10.0.0.2:6379')],
    new ClientOptions(timeout: 5.0),
);
$cluster->executeKeyed('user.1', 'GET', 'user.1');

use Amp\Redis\RedisClient;

$redis = new RedisClient($client->link());
$redis->set('user.1', 'payload');