11var redisSendCommand ;
2-
32var blacklist = [ 'info' ] ;
43
54module . exports = function ( redis ) {
65 redisSendCommand = redisSendCommand || redis . RedisClient . prototype . internal_send_command ;
7- return function ( req , res , next ) {
8-
9- redis . RedisClient . prototype . internal_send_command = ! req . miniprofiler . enabled ? redisSendCommand : function ( command , args , callback ) {
10- var query = `${ command } ${ args . join ( ', ' ) } ` . trim ( ) ;
11- if ( this . ready && blacklist . indexOf ( command ) == - 1 )
12- req . miniprofiler . timeQuery ( 'redis' , query , redisSendCommand . bind ( this ) , command , args , callback ) ;
13- else
14- redisSendCommand . call ( this , command , args , callback ) ;
15- } ;
166
17- next ( ) ;
18- } ;
19- } ;
7+ return {
8+ name : 'redis' ,
9+ handler : function ( req , res , next ) {
10+
11+ redis . RedisClient . prototype . internal_send_command = ! req . miniprofiler . enabled ? redisSendCommand : function ( command , args , callback ) {
12+ var query = `${ command } ${ args . join ( ', ' ) } ` . trim ( ) ;
13+ if ( this . ready && blacklist . indexOf ( command ) == - 1 )
14+ req . miniprofiler . timeQuery ( 'redis' , query , redisSendCommand . bind ( this ) , command , args , callback ) ;
15+ else
16+ redisSendCommand . call ( this , command , args , callback ) ;
17+ } ;
18+
19+ next ( ) ;
20+ }
21+ } ;
22+ } ;
0 commit comments