A CodeIgniter interface for the Redis data store. This library tries to adhere to the defined protocol, including responses.
- PHP 5+
- CodeIgniter 2.0+
- A Redis server compatible with the unified request protocol (Redis 1.2+)
This library is also released as a Spark. If you use this library in any other way, don't copy the autoload.php to your config directory.
This library expects a configuration file to function correctly. A template for this file is provided with the library.
You can execute any command using the command()
method, just like you're using redis-cli.
$this->redis->command('PING');
This library also support PHP's overloading functionality. This means you can call undefined methods, which are then dynamically created for you. These calls are routed to the generic __call()
method. You can also pass in arrays.
$this->redis->hmset('foohash', array('key1' => 'value1', 'key2' => 'value2'));
Set a new key with a value and retrieve it again
$this->redis->set('foo', 'bar');
Get a value by its key
$this->redis->get('foo');
Delete a bunch of keys
$this->redis->del(array('foo', 'foo2'));
I am a firm believer of social coding, so if when you find a bug, please fork my code on GitHub and squash it. I will be happy to merge it back in to the code base (and add you to the "Thanks to" section). If you're not too comfortable using Git or messing with the inner workings of this library, please open a new issue.
This library is released under the MIT license.
- Daniel Hunsaker for fixing a bug related to passing 3+ arguments and his input on different issues.
- Tim Post for taking the time to fix a long standing 'space' bug.
- ysbaddaden for the idea of splitting the different responses in his
read_raw_reply()
method. - Lucas Nolte for filing bug reports and submitting patches.
Cheers, –– Joël Cox