9951 explained code solutions for 126 technologies


php-swooleRedis connection and get/set example


Co\run(function()
{
  go(function() {
    $rd = new Redis();
    $rd->connect('127.0.0.1', 6379);
    $rd->set('some', 'val');
    print_r($rd->get('name'));
  });
});ctrl + c
new Redis()

create Redis object

$rd->connect

connect to Redis server

$rd->set

save val value to some key

$rd->get

get value of name key