xp-forge / redis
Redis Protocol
Installs: 1 079
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.0.0
- xp-forge/uri: ^2.0 | ^1.0
- xp-framework/core: ^12.0 | ^11.0 | ^10.0 | ^9.0 | ^8.0 | ^7.0
- xp-framework/networking: ^10.0 | ^9.0 | ^8.0 | ^7.0
Requires (Dev)
- xp-framework/test: ^2.0 | ^1.0
README
Redis protocol implementation.
Example
use io\redis\RedisProtocol; $protocol= new RedisProtocol('redis://localhost'); $protocol->command('SET', 'key', 'value'); $value= $protocol->command('GET', 'key');
The port defaults to 6379 and can be changed by adding it as follows: redis://localhost:16379. To use authentication, pass it as username in the connection string, e.g. redis://secret@localhost.
Pub/Sub
use io\redis\RedisProtocol; $protocol= new RedisProtocol('redis://localhost'); $protocol->command('SUBSCRIBE', 'messages'); while ($message= $protocol->receive()) { Console::writeLine('Received ', $message); }