(uuid: string)
| 438 | } |
| 439 | |
| 440 | add(uuid: string): void { |
| 441 | if (this.set.has(uuid)) return |
| 442 | // Evict the entry at the current write position (if occupied) |
| 443 | const evicted = this.ring[this.writeIdx] |
| 444 | if (evicted !== undefined) { |
| 445 | this.set.delete(evicted) |
| 446 | } |
| 447 | this.ring[this.writeIdx] = uuid |
| 448 | this.set.add(uuid) |
| 449 | this.writeIdx = (this.writeIdx + 1) % this.capacity |
| 450 | } |
| 451 | |
| 452 | has(uuid: string): boolean { |
| 453 | return this.set.has(uuid) |
no test coverage detected