You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
update benchmarks
This commit is contained in:
27
benchmark/lib/set-get-delete-string/v3.js
Normal file
27
benchmark/lib/set-get-delete-string/v3.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { createClient } from 'redis-v3';
|
||||
import { once } from 'events';
|
||||
import { promisify } from 'util';
|
||||
|
||||
export default async (host, { randomString }) => {
|
||||
const client = createClient({ host }),
|
||||
setAsync = promisify(client.set).bind(client),
|
||||
getAsync = promisify(client.get).bind(client),
|
||||
delAsync = promisify(client.del).bind(client),
|
||||
quitAsync = promisify(client.quit).bind(client);
|
||||
|
||||
await once(client, 'connect');
|
||||
|
||||
return {
|
||||
benchmark() {
|
||||
return Promise.all([
|
||||
setAsync(randomString, randomString),
|
||||
getAsync(randomString),
|
||||
delAsync(randomString)
|
||||
]);
|
||||
},
|
||||
teardown() {
|
||||
return quitAsync();
|
||||
}
|
||||
};
|
||||
|
||||
};
|
Reference in New Issue
Block a user