Core concepts
Predicting user behavior
Glacier predicts what to warm from the traffic it already sees — but a few well-placed hints make those predictions sharper and faster to converge.
What Glacier learns on its own
Out of the box, Glacier observes every fetch that flows through it and builds a rolling model of access patterns: which entries follow which, how recently each was touched, and which tend to be requested together. You don't have to configure anything for this to work — the model warms up after the first few hundred requests.
Giving explicit hints
When you already know what's coming — a user opened a record that always loads three related queries, for example — tell Glacier directly with predict():
// Warm the data a detail view is about to need
glacier.predict(['user:42', 'orders:user:42', 'invoices:user:42'])
A hint raises the confidence score for those keys immediately, so they're warmed without waiting for the pattern to be learned.
Route-level hints
For apps with predictable navigation, map a route to the keys it depends on:
glacier.routeHint('/dashboard', () => [
'metrics:current',
'activity:recent',
])
Hints are advisory, never required
A hint nudges Glacier's confidence; it doesn't force a fetch or override your ttl. If a hinted key is never requested, it simply expires like any other warmed entry — bounded, cheap, and harmless.
Tuning sensitivity
The confidence threshold controls how eager Glacier is to warm data. Lower it to prefetch more aggressively (higher hit rate, more wasted fetches); raise it to be conservative. Start at the default and adjust using the numbers from Observability.
Next: Cache invalidation covers how warmed data leaves the cache.