(info: string, key: string)
| 213 | |
| 214 | // Read a single integer field out of the Redis INFO memory section. |
| 215 | function parseRedisInfoValue(info: string, key: string): number | null { |
| 216 | const line: string | undefined = info |
| 217 | .split(/\r?\n/) |
| 218 | .find((current: string): boolean => { |
| 219 | return current.startsWith(`${key}:`); |
| 220 | }); |
| 221 | |
| 222 | if (!line) { |
| 223 | return null; |
| 224 | } |
| 225 | |
| 226 | return toNumberOrNull(line.split(":")[1]); |
| 227 | } |
| 228 | |
| 229 | async function getRedisStats(): Promise<JSONObject> { |
| 230 | const result: JSONObject = { |
no test coverage detected