Skip to content

0.0.40

Compare
Choose a tag to compare
@bvaughn bvaughn released this 24 Jun 20:26
· 32 commits to main since this release
  • Added opt-in debug logging per cache (enableDebugLogging config) as well as globally (enableDebugLogging export) for development builds.
  • Add (DEV-only) warning to createIntervalCache and createStreamingCache for non-unique cache keys– specifically warning about the key containing an Object case as a string.

Debug logging

In development mode, "suspense" can be configured to log timing information. Logging can be enabled/disabled per cache:

import { createCache } from "suspense";

// Cache can be configured during initialization
const cache = createCache({
  debugLogging: true,
  load,
});

// They can also be turned on/off later
cache.disableDebugLogging();
cache.enableDebugLogging();

It can also be done globally (for all caches).

import { disableDebugLogging, enableDebugLogging } from "suspense";

// Turns debug logging on for all caches
enableDebugLogging();

// Turns debug logging off for all caches
disableDebugLogging();