burgov / predis-wrapper
A set of helper classes around Predis
1.1.0
2014-03-18 13:29 UTC
Requires
- php: >=5.3.3
- predis/predis: *
Requires (Dev)
- satooshi/php-coveralls: dev-master
- symfony/console: *
- symfony/css-selector: *
- symfony/dom-crawler: *
- symfony/process: *
This package is not auto-updated.
Last update: 2024-11-18 17:12:23 UTC
README
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 $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');
$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