# TagCache.invalidate() method · @imqueue/tag-cache

Source: https://imqueue.org/api/tag-cache/latest/tag-cache.tagcache.invalidate/
Published: 2026-07-31
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/tag-cache 3.0.3 — generated reference, not hand-written

Invalidates data under given tags

Collects every key held by the given tags, deletes those keys, and then removes them from all other tag sets so no tag is left pointing at a key that no longer exists.

Two properties worth knowing, because neither is obvious from the signature:

- \*\*It resolves before the work is confirmed.\*\* The deletion is dispatched as a `MULTI` whose result is not awaited — a failure is logged, not returned. So a `true` result means "the invalidation was issued", not "the keys are gone". Do not use it to order a subsequent read. - \*\*The cleanup pass scans every tag\*\*, not just the ones passed in, since a key may be held by tags other than those being invalidated. Cost therefore grows with the total number of tags in the keyspace rather than with the size of `tags`.

**Signature:**

```typescript
invalidate(...tags: string[]): Promise<boolean>;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| tags | string\[\] | one or more tags whose data should be dropped |


**Returns:**

Promise<boolean>

`true` if the invalidation was issued, including the case where the tags held no keys at all; `false` only if collecting the keys failed, which is logged rather than thrown

## Exceptions

TypeError when there is no redis connection — see [REDIS\_INIT\_ERROR](https://imqueue.org/api/tag-cache/latest/tag-cache.redis_init_error/)

