xp-forge / redis

Redis Protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redis protocol

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.0+ Supports PHP 8.0+ Latest Stable Version

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);
}

About

Redis Protocol


Languages

Language:PHP 100.0%