@@ -9,105 +9,101 @@ function RedisStore (name, redisOptions, poolOptions) {
99 const pool = new RedisPool ( name , redisOptions , poolOptions ) ;
1010 logger . info ( "Redis store created." , pool . status ( ) ) ;
1111
12- function release ( conn ) {
13- return pool . release ( conn ) ;
14- }
15-
1612 this . getName = bind ( pool . getName , pool ) ;
1713 this . getDB = bind ( pool . getDB , pool ) ;
1814 this . status = bind ( pool . status , pool ) ;
1915
20- this . get = function ( key ) {
16+ this . get = ( key ) => {
2117
2218 return pool . acquire ( )
23- . then ( function ( conn ) {
19+ . then ( ( conn ) => {
2420 return conn . getAsync ( key )
25- . then ( function ( result ) {
26- release ( conn ) ;
21+ . then ( ( result ) => {
22+ pool . release ( conn ) ;
2723 return result ;
2824 } ) ;
2925 } ) ;
3026 } ;
3127
32- this . set = function ( key , value ) {
28+ this . set = ( key , value ) => {
3329
3430 return pool . acquire ( )
35- . then ( function ( conn ) {
31+ . then ( ( conn ) => {
3632 return conn . setAsync ( key , value )
37- . then ( function ( result ) {
38- release ( conn ) ;
33+ . then ( ( result ) => {
34+ pool . release ( conn ) ;
3935 return result ;
4036 } ) ;
4137 } ) ;
4238 } ;
4339
44- this . setex = function ( key , value , ttl ) {
40+ this . setex = ( key , value , ttlInSeconds ) => {
4541
4642 return pool . acquire ( )
47- . then ( function ( conn ) {
48- return conn . setexAsync ( key , ttl , value )
49- . then ( function ( result ) {
50- release ( conn ) ;
43+ . then ( ( conn ) => {
44+ return conn . setexAsync ( key , ttlInSeconds , value )
45+ . then ( ( result ) => {
46+ pool . release ( conn ) ;
5147 return result ;
5248 } ) ;
5349 } ) ;
5450 } ;
5551
56- this . del = function ( key ) {
52+ this . del = ( key ) => {
5753
5854 return pool . acquire ( )
59- . then ( function ( conn ) {
55+ . then ( ( conn ) => {
6056 return conn . delAsync ( key )
61- . then ( function ( result ) {
62- release ( conn ) ;
57+ . then ( ( result ) => {
58+ pool . release ( conn ) ;
6359 return result ;
6460 } ) ;
6561 } ) ;
6662 } ;
6763
68- this . ttl = function ( key ) {
64+ this . ttlInSeconds = ( key ) => {
6965
7066 return pool . acquire ( )
71- . then ( function ( conn ) {
72- return conn . ttlAsync ( key )
73- . then ( function ( result ) {
74- release ( conn ) ;
67+ . then ( ( conn ) => {
68+ return conn . ttlInSecondsAsync ( key )
69+ . then ( ( result ) => {
70+ pool . release ( conn ) ;
7571 return result ;
7672 } ) ;
7773 } ) ;
7874 } ;
7975
80- this . keys = function ( pattern ) {
76+ this . keys = ( pattern ) => {
8177 if ( ! pattern || pattern === "" ) {
8278 pattern = "*" ;
8379 }
8480
8581 return pool . acquire ( )
86- . then ( function ( conn ) {
82+ . then ( ( conn ) => {
8783 return conn . keysAsync ( pattern )
88- . then ( function ( result ) {
89- release ( conn ) ;
84+ . then ( ( result ) => {
85+ pool . release ( conn ) ;
9086 return result ;
9187 } ) ;
9288 } ) ;
9389 } ;
9490
9591
96- this . deleteAll = function ( pattern ) {
92+ this . deleteAll = ( pattern ) => {
9793 if ( ! pattern || pattern === "" ) {
9894 pattern = "*" ;
9995 }
10096 logger . info ( "clearing redis keys: " , pattern ) ;
10197
10298 return pool . acquire ( )
103- . then ( function ( conn ) {
99+ . then ( ( conn ) => {
104100 return conn . keysAsync ( pattern )
105- . then ( function ( keys ) {
101+ . then ( ( keys ) => {
106102 if ( keys . length > 0 ) {
107103 debug ( "deleting keys " , keys ) ;
108104 return conn . delAsync ( keys )
109- . then ( function ( result ) {
110- release ( conn ) ;
105+ . then ( ( result ) => {
106+ pool . release ( conn ) ;
111107 return result ;
112108 } ) ;
113109 }
0 commit comments