(key)
| 133 | } |
| 134 | |
| 135 | export function cacheGet(key) { |
| 136 | if (!isCacheEnabled()) return null; |
| 137 | const entry = _store.get(key); |
| 138 | if (!entry) { _stats.misses++; return null; } |
| 139 | if (entry.expiresAt < Date.now()) { |
| 140 | deleteEntry(key); |
| 141 | _stats.misses++; |
| 142 | return null; |
| 143 | } |
| 144 | // Refresh LRU position |
| 145 | _store.delete(key); |
| 146 | _store.set(key, entry); |
| 147 | _stats.hits++; |
| 148 | return entry.value; |
| 149 | } |
| 150 | |
| 151 | export function cacheSet(key, value) { |
| 152 | if (!isCacheEnabled()) return; |
no test coverage detected