Caching
JustKalm intelligently caches valuations to improve performance and reduce costs. Understand our caching strategy to optimize your integration.
Cache Headers
Every API response includes cache headers that indicate the caching status and remaining validity.
| Header | Description |
|---|---|
| X-JustKalm-Cache | HIT or MISS |
| X-JustKalm-Cache-Age | Seconds since cached |
| X-JustKalm-Cache-TTL | Seconds until expiry |
| ETag | Unique content identifier |
| Cache-Control | Standard HTTP cache directives |
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: public, max-age=3600, stale-while-revalidate=86400
ETag: "abc123xyz"
X-JustKalm-Cache: HIT
X-JustKalm-Cache-Age: 1823
X-JustKalm-Cache-TTL: 1777
{
"price_min": 150,
"price_max": 250,
...
}TTL Policies
Cache duration varies based on item type and market volatility:
Everyday clothing, accessories. Low price volatility.
Designer goods, popular brands. Moderate volatility.
Limited editions, hyped releases. High market activity.
Conditional Requests
Use ETags for conditional requests to minimize bandwidth and costs. A 304 response means your cached data is still valid.
No body returned, use your local cache
304 responses don't count against quotas
Minimal response size means faster transfers
// Use ETag for conditional requests
const response = await fetch('https://api.justkalm.com/v2/valuate', {
method: 'POST',
headers: {
'Authorization': 'Bearer jk_live_xxx',
'If-None-Match': '"abc123xyz"', // ETag from previous response
'Content-Type': 'application/json',
},
body: JSON.stringify({ url: 'https://example.com/item' })
});
if (response.status === 304) {
// Cached data is still valid, use local cache
console.log('Using cached valuation');
} else {
// New data available
const valuation = await response.json();
}Cache Invalidation
// Force cache refresh
const response = await fetch('https://api.justkalm.com/v2/valuate', {
method: 'POST',
headers: {
'Authorization': 'Bearer jk_live_xxx',
'Cache-Control': 'no-cache', // Bypass cache
'Content-Type': 'application/json',
},
body: JSON.stringify({ url: 'https://example.com/item' })
});
// Or use the refresh parameter
const fresh = await client.valuate({
url: 'https://example.com/item',
refresh: true, // Force fresh valuation
});When to Bypass Cache
For checkout flows where accuracy is critical
When you know the listing was updated
Fresh requests cost more and are slower
Global Edge Cache
Infrastructure
- Edge Locations50+ worldwide
- Cache ProviderCloudflare Enterprise
- Origin ShieldUS-East, EU-West, AP-Tokyo
- Avg Cache Hit Rate94%
Cache Layers
Need Custom Caching?
Enterprise plans include custom TTL configuration and cache purge APIs.