* @internal please do not use.
(value: T, cacheReplace?: boolean)
| 852 | * @internal please do not use. |
| 853 | */ |
| 854 | private updateCache(value: T, cacheReplace?: boolean): void { |
| 855 | if (cacheReplace === true) { |
| 856 | this._cachedValues[this.cacheIndex] = value; |
| 857 | } else { |
| 858 | if (this.cachedValuesCount === 0 || this.cacheIndex === this.cachedValuesCount - 1) { |
| 859 | this._cachedValues.push(value); |
| 860 | if (this.cachedValuesCount > this.cacheSize) { |
| 861 | this._cachedValues.shift(); |
| 862 | } |
| 863 | this._cacheIndex = this.cachedValuesCount - 1; |
| 864 | } else { |
| 865 | this._cachedValues.splice( |
| 866 | this.cacheIndex + 1, |
| 867 | this.cachedValuesCount - 1 - this.cacheIndex, |
| 868 | value |
| 869 | ); |
| 870 | ++this._cacheIndex; |
| 871 | } |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | /** |
| 876 | * @internal please do not use. |