File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ interface NormalizedRedisClient {
12
12
}
13
13
14
14
interface Serializer {
15
- parse ( s : string ) : SessionData
15
+ parse ( s : string ) : SessionData | Promise < SessionData >
16
16
stringify ( s : SessionData ) : string
17
17
}
18
18
@@ -83,7 +83,7 @@ class RedisStore extends Store {
83
83
try {
84
84
let data = await this . client . get ( key )
85
85
if ( ! data ) return cb ( )
86
- return cb ( null , this . serializer . parse ( data ) )
86
+ return cb ( null , await this . serializer . parse ( data ) )
87
87
} catch ( err ) {
88
88
return cb ( err )
89
89
}
Original file line number Diff line number Diff line change @@ -113,9 +113,11 @@ This option disables key expiration requiring the user to manually manage key cl
113
113
114
114
Provide a custom encoder/decoder to use when storing and retrieving session data from Redis (default: ` JSON.parse ` and ` JSON.stringify ` ).
115
115
116
+ Optionally ` parse ` method can be async if need be.
117
+
116
118
``` ts
117
119
interface Serializer {
118
- parse(string ): object
120
+ parse(string ): object | Promise < object >
119
121
stringify(object ): string
120
122
}
121
123
```
You can’t perform that action at this time.
0 commit comments