multi.php 388 B

12345678910111213141516171819
  1. <?php
  2. const REDIS_SERVER_HOST = '127.0.0.1';
  3. const REDIS_SERVER_PORT = 6379;
  4. go(function () {
  5. $redis = new Swoole\Coroutine\Redis();
  6. $redis->connect(REDIS_SERVER_HOST, REDIS_SERVER_PORT);
  7. $redis->multi();
  8. $redis->set('key3', 'rango');
  9. $redis->get('key1');
  10. $redis->get('key2');
  11. $redis->get('key3');
  12. $result = $redis->exec();
  13. var_dump($result);
  14. });