soundcloud-api-ts-next
    Preparing search index...

    Interface CacheOptions

    next/cache caching options for server helpers.

    When next/cache is available (i.e. inside a Next.js runtime), helpers wrap the underlying fetch with unstable_cache using these options. Outside of Next.js (e.g. in tests or plain Node), the options are ignored and the raw API call is made directly.

    // Cache for 60 seconds, tagged for on-demand invalidation
    const track = await getTrack(123, config, { revalidate: 60, tags: ["track-123"] });

    // Never cache (always fresh)
    const me = await getMe(config, { revalidate: false });
    interface CacheOptions {
        revalidate?: number | false;
        tags?: string[];
    }
    Index

    Properties

    Properties

    revalidate?: number | false

    Time-to-live in seconds for the cached result.

    • A positive number: cache for that many seconds.
    • false: opt out of caching (equivalent to no-store).
    • Omitted: use Next.js default (typically force-cache / indefinitely).
    tags?: string[]

    Cache tags for on-demand invalidation via revalidateTag. Use scCacheKeys to generate consistent tag arrays.

    import { scCacheKeys } from "soundcloud-api-ts-next/server";
    await getTrack(123, config, { tags: scCacheKeys.track(123) });
    // Later: revalidateTag("sc"); // or "track" / "123"