PHP code example of redisent / redis

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

    

redisent / redis example snippets


$redis->set('foo', 'bar')
// SET foo bar

$redis->lpush('particles', 'electron')
// LPUSH particles electron
$redis->lpush('particles', 'proton')
// LPUSH particles proton
$redis->lpush('particles', 'neutron')
// LPUSH particles neutron
$redis->llen('particles')
// LLEN particles

$redis->pipeline()
  ->set('X', 2)
  ->incr('X')
  ->incr('X')
  ->uncork(); // #=> array containing the responses of each command


$redis = new redisent\Redis('redis://localhost');
$redis->set('awesome', 'absolutely');
echo "Is Redisent awesome? ", $redis->get('awesome'), "\n";

$redis = new Redisent\Redis();
$responses = $redis->pipeline()
    ->incr('X')
    ->incr('X')
    ->incr('X')
    ->incr('X')
    ->uncork();
print_r($responses);