| 85 | } |
| 86 | |
| 87 | append (item) { |
| 88 | // maxSize may be 0 when initialized by a .filter() copy-construction |
| 89 | if (this.maxSize && (this.length === this.maxSize)) { |
| 90 | this.shift () |
| 91 | } |
| 92 | this.push (item) |
| 93 | if (this.clearAllUpdates) { |
| 94 | this.clearAllUpdates = false |
| 95 | this.clearUpdatesBySymbol = {} |
| 96 | this.allNewUpdates = 0 |
| 97 | this.newUpdatesBySymbol = {} |
| 98 | } |
| 99 | if (this.clearUpdatesBySymbol[item.symbol]) { |
| 100 | this.clearUpdatesBySymbol[item.symbol] = false |
| 101 | this.newUpdatesBySymbol[item.symbol] = 0 |
| 102 | } |
| 103 | this.newUpdatesBySymbol[item.symbol] = (this.newUpdatesBySymbol[item.symbol] || 0) + 1 |
| 104 | this.allNewUpdates = (this.allNewUpdates || 0) + 1 |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | class ArrayCacheByTimestamp extends BaseCache { |