PHP code example of burgov / predis-wrapper

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

    

burgov / predis-wrapper example snippets


$client = new Burgov\PredisWrapper\Client(new Predis\Client(/* ... */));

$string = new Scalar($client, 'string_key');
$set = new Set($client, 'set_key');
$sortedSet = new SortedSet($client, 'sorted_set_key');
$hash = new Hash($client, 'hash_key');
$list = new PList($client, 'list_key'); // unfortunately, "list" is a reserved word in PHP

$factory = new TypeFactory($client);
// when you're sure "some_key" exists. This will return an instance of the appropriate class
$factory->instantiate('some_key');
// when you're expecting "some_set_key" to be a set or non existent. Will throw exception if it is something else.
$factory->instantiateSet('some_set_key');