( cache: Keyv, key: string, value: Record<string, any> | Record<string, any>[], ttl: number, )
| 169 | * Store a value in cache with its expiration timestamp for TTL tracking |
| 170 | */ |
| 171 | export async function setCacheValueWithExpiry( |
| 172 | cache: Keyv, |
| 173 | key: string, |
| 174 | value: Record<string, any> | Record<string, any>[], |
| 175 | ttl: number, |
| 176 | ) { |
| 177 | await setCacheValue(cache, key, value, ttl); |
| 178 | await setCacheValue(cache, `${key}__expires_at`, { exp: Date.now() + ttl }, ttl); |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * Get a cached value along with its remaining TTL |
no test coverage detected