ConstReadonlyme: () => string[]Cache key parts for the authenticated user's profile (/me).
Readonlyplaylist: (id: string | number) => string[]Cache key parts for a single playlist.
ReadonlysearchTracks: (q: string) => string[]Cache key parts for a track search query.
Readonlytrack: (id: string | number) => string[]Cache key parts for a single track.
Readonlyuser: (id: string | number) => string[]Cache key parts for a single user profile.
import { scCacheKeys } from "soundcloud-api-ts-next/server";
import { revalidateTag } from "next/cache";
// Invalidate a single track after an update
revalidateTag(scCacheKeys.track(123).join(":"));
// Or use the keys as the `tags` array for unstable_cache:
const cachedGetTrack = unstable_cache(
(id: number) => sc.client.tracks.getTrack(id),
scCacheKeys.track(123), // keyParts
{ tags: scCacheKeys.track(123) },
);
Cache key factory helpers for use with
next/cacherevalidateTagandunstable_cache.Using consistent, predictable cache keys lets you granularly invalidate cached SoundCloud data with
revalidateTag— for example, after a track is updated or a user profile changes.