Skip to content

Instantly share code, notes, and snippets.

@consatan
Created July 5, 2016 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save consatan/ccb69768e2b4619801bc8d0a4edda395 to your computer and use it in GitHub Desktop.
Save consatan/ccb69768e2b4619801bc8d0a4edda395 to your computer and use it in GitHub Desktop.
Redis 插入100万数据到 List
<?php
$time = microtime(true);
ini_set('memory_limit', -1);
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$arr = range(1, 1000000);
array_unshift($arr, 'test');
$redis->delete('test');
$redis->multi(Redis::PIPELINE);
call_user_func_array([$redis, 'rpush'], $arr);
$redis->exec();
var_dump((microtime(true) - $time) * 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment