Skip to main content
Version: Next

cacheTag

cacheTag(tag): void

Sets a custom identifier for the current cache operation

const fetchUser = cache(async (id: string) => {
cacheTag(`user:${id}`);
return await db.users.findOne(id);
});
ParameterTypeOptionalDescription
tagstringThe custom cache tag