Hey! Keep up to date with the project through its beta and public launch by following @getsparks.Tweet
CodeIgniter Starter Project − A Starting Point for Any CI Dev
December 12, 2011
A CodeIgniter library to interact with Redis
|: Log in to view|
|Author Website||: http://joelcox.nl|
|Spark Website||: https://github.com/joelcox/codeigniter-redis|
|Repository Type||: git|
|Number of Installs||: 2,955|
php tools/spark install -v0.4.1 redisOr download this version manually: Get redis-0.4.1.zip
A CodeIgniter interface for the Redis data store. This library tries to adhere to the defined protocol, including responses.
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.
As of v0.4, this library does not longer support the plain text syntax for overloaded commands (i.e.
$this->redis->set('foo bar')). Please pass extra command arguments as real PHP arguments instead (i.e.
$this->redis->set('foo', 'bar')). You can still use the plain text syntax using the
command method (e.g.
$this->redis->command('SET foo bar')) if you need this functionality.
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 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
Get a value by its key
Delete a bunch of keys
Because PHP lacks basic list and dictionary/map/hash data types, this library tries to detect this on its own. This is done by using the following heuristic; if the smallest key in an array equals 0 and the largest key equals the length of the array - 1, the array is considered to be a list. In this case, the library's internals will automatically strip away the keys before passing the array to the Redis server.
I am a firm believer of social coding, so if you find a bug, please fork this 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.
Cheers, –– Joël Cox
php tools/spark install -v0.3.0 redisOr download this version manually: Get redis-0.3.0.zip
php tools/spark install -v0.2.0 redisOr download this version manually: Get redis-vv0.2.zip
php tools/spark install -v0.1.0 redisOr download this version manually: Get redis-vv0.1.zip