(item: T)
| 36 | } |
| 37 | |
| 38 | push(item: T): void { |
| 39 | if (this.size === this.capacity) { |
| 40 | this.buffer[this.tail] = item; |
| 41 | this.head = (this.head + 1) % this.capacity; |
| 42 | this.tail = (this.tail + 1) % this.capacity; |
| 43 | this.deleted = true; |
| 44 | } else { |
| 45 | this.buffer[this.tail] = item; |
| 46 | this.tail = (this.tail + 1) % this.capacity; |
| 47 | this.size++; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | getCache() { |
| 52 | const result: T[] = []; |