invalidateCache
Invalidate Redis records by associated tags.
This method communicated with the Redis server directly to get all keys associated with the given tags. Then it deletes the records associated with these keys. Finally, it also deletes the tags.
Signature
declare function invalidateCache(
props: InvalidateCacheProps
): Promise<void>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | InvalidateCacheProps | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
This method does not return anything.
Referenced Types
Examples
Invalidating selected records by tags.
import { sdk } from '~/sdk';
await sdk.redis.invalidateCache({ tags: ['example-tag'] });Invalidating all records.
import { sdk } from '~/sdk';
await sdk.redis.invalidateCache({ tags: '*' });