A set of helper classes around Predis

1.1.0 2014-03-18 13:29 UTC

This package is not auto-updated.

Last update: 2024-02-26 13:10:46 UTC


Build Status Coverage Status

A set of helper classes around the Predis library

$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

Or use the factory:

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

$factory will always try to return the same instance of a type based on the key

See usage examples in the integration tests:

Here is a list of all the redis commands that are wrapped (so far): Wrapped commands