Record a use (read or write) of a memory file at the MemoryService chokepoint.
(logicalKey: string, options: { write: boolean })
| 199 | |
| 200 | /** Record a use (read or write) of a memory file at the MemoryService chokepoint. */ |
| 201 | async recordAccess(logicalKey: string, options: { write: boolean }): Promise<void> { |
| 202 | await this.mutate((entries) => { |
| 203 | const current = entries[logicalKey] ?? EMPTY_ENTRY; |
| 204 | const now = Date.now(); |
| 205 | entries[logicalKey] = { |
| 206 | ...current, |
| 207 | accessCount: current.accessCount + 1, |
| 208 | lastAccessedAt: now, |
| 209 | lastWriteAt: options.write ? now : current.lastWriteAt, |
| 210 | }; |
| 211 | }); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Move all entries for a renamed file or directory subtree so pins and |