PHP code example of yasd / redis

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

    

yasd / redis example snippets


use YaSD\Redis\RedisClient;

$redisConfig = [
    'host' => '127.0.0.1',
    'port' => 6379,
    'auth' => 'auth string or user_pass array or null',
];

$redis = RedisClient::create($redisConfig);
$redis->getRedis()->doSomething();
$redis->getRedis(ping: true)->doSomething();
$redis->ping()->getRedis()->doSomething();

use YaSD\Redis\RedisClient;

$redisConfig = [
    'host'         => '127.0.0.1',
    'port'         => 6379,
    'persistentId' => 'persistentId or null',
    'auth'         => 'auth string or user_pass array or null',
];

$redis = RedisClient::createPersistent($redisConfig);
$redis->ping()->getRedis()->doSomething();