Executing Redis commands in PHP
suggest changeThe Redis PHP module gives access to the same commands as the Redis CLI client so it is quite straightforward to use.
The syntax is as follow:
// Creates two new keys:
$redis->set('mykey-1', 123);
$redis->set('mykey-2', 'abcd');
// Gets one key (prints '123')
var_dump($redis->get('mykey-1'));
// Gets all keys starting with 'my-key-'
// (prints '123', 'abcd')
var_dump($redis->keys('mykey-*'));
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents