Caching Strategies

Intelligent caching that reduces costs and latency while maintaining freshness

MCPify's caching layer is designed specifically for AI agents: repeated calls are served from cache, so answers come back faster and your upstream API sees fewer requests.

Multi-Tier Cache Architecture

Response Cache

High-performance in-memory cache for API responses and computed results

Cached Content

  • • API responses
  • • Aggregated data
  • • Temporary results

Configuration

  • • TTL: set per tool

Durable Cache

Long-lived cache for responses from append-only APIs

Cached Content

  • • Responses from append-only APIs

Configuration

  • • Stored durably
  • • Fast copy for quick reads

Cache Controls for AI Agents

Agent Controls

Agents can control caching behavior per request:

  • _freshData: true - Ask for fresh data from the API

Automatic Invalidation

Cached reads are cleared when data changes through the gateway:

  • Writes through the gateway clear the cached reads they affect
  • Scoped to the tenant or user that made the change

Caching Strategies

Time-Based Caching (TTL)

Each tool has its own time-to-live.

Best for: Reference data, catalog information, slowly changing content

Performance Impact

What caching changes

The size of each effect depends on your API — how repeatable the requests are, how large the responses are, and how long the data stays valid.

Response timeServed from cache
Upstream API costRepeat calls served from cache
Token usageShaped per tool
Cache hit rateDepends on your traffic

Caching Best Practices

✅ Do's

  • • Set appropriate TTLs based on data volatility
  • • Implement cache warming for critical data
  • • Respect cache headers from origin

❌ Don'ts

  • • Don't cache sensitive or personal data
  • • Don't use excessive TTLs for dynamic data
  • • Don't ignore cache invalidation events
  • • Don't cache error responses
  • • Don't forget to vary cache by user context
  • • Don't disable caching without measurement

Cache behavior for your service

Contact us about cache behavior for your service: what is cached and for how long. See Observability for what is collected.

Related Documentation