Skip to main content

Caching

⚠️ use caching at your own risk ⚠️

Using caching prevents ThumbmarkJS from making API calls on the same browser when the cache lifetime has not expired. This will often lead to less accurate visitor identification, and increases the likelihood of a visitor being generated a new identifier.

Caching can reduce costs by lowering the number of API calls made to ThumbmarkJS.

Usage

const t = new Thumbmark(
{
api_key: 'your-api-key',
cache_lifetime_in_ms: 60 * 1000 // sets a 1 minute cache lifetime
}
);
const tm = await t.get();

Maximum cache lifetime is 72 hours, but anything that goes beyond a normal duration of your web session is highly risky.