* Adds a query to the cache. * @internal * @param query - The query to add. If a query with the same hash is already cached, nothing * happens.
(query: Query<any, any, any, any>)
| 206 | * happens. |
| 207 | */ |
| 208 | add(query: Query<any, any, any, any>): void { |
| 209 | if (!this.#queries.has(query.queryHash)) { |
| 210 | this.#queries.set(query.queryHash, query) |
| 211 | |
| 212 | this.notify({ |
| 213 | type: 'added', |
| 214 | query, |
| 215 | }) |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * Destroys the given `Query` and removes it from the cache, notifying subscribers with a |