(key: string)
| 182 | } |
| 183 | |
| 184 | async get(key: string): Promise<string | null> { |
| 185 | if (this.client) { |
| 186 | try { |
| 187 | return await this.client.get(key); |
| 188 | } catch (error) { |
| 189 | this.logger.error(`Redis GET failed: key=${key}, error=${error}`); |
| 190 | throw error; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | // In-memory implementation |
| 195 | const item = this.inMemoryStore.get(key); |
| 196 | if (!item) { |
| 197 | return null; |
| 198 | } |
| 199 | |
| 200 | if (this.isExpired(item)) { |
| 201 | this.inMemoryStore.delete(key); |
| 202 | return null; |
| 203 | } |
| 204 | |
| 205 | return item.value; |
| 206 | } |
| 207 | |
| 208 | async incr(key: string): Promise<number> { |
| 209 | if (this.client) { |
no test coverage detected