You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
22 lines
486 B
JavaScript
22 lines
486 B
JavaScript
import { createClient } from 'redis-v3';
|
|
import { once } from 'events';
|
|
import { promisify } from 'util';
|
|
|
|
export default async (host) => {
|
|
const client = createClient({ host }),
|
|
pingAsync = promisify(client.ping).bind(client),
|
|
quitAsync = promisify(client.quit).bind(client);
|
|
|
|
await once(client, 'connect');
|
|
|
|
return {
|
|
benchmark() {
|
|
return pingAsync();
|
|
},
|
|
teardown() {
|
|
return quitAsync();
|
|
}
|
|
};
|
|
|
|
};
|