Automatic Cache Invalidation

Keeping Your Data Fresh

The SuperAPI Approach

SuperAPI tackles cache invalidation with a practical two-part monitoring system that keeps your data fresh without performance penalties:

Database-Level Monitoring:

SuperAPI automatically listens to your database's replication stream, which allows us to detect any changes to your data that occurs by:

  • Capturing every data mutation (insertions, updates, deletions) as it happens
  • Mapping these changes to potentially affected cache entries
  • Surgically removing or updating only the exact cache entries impacted by the change
  • Often performing "in-place" cache updates rather than full invalidations, preserving cache efficiency

This catches all data changes regardless of where they come from - scheduled jobs, batch processes, direct database operations, or third-party systems that bypass your API entirely.

API-Level Monitoring:

SuperAPI also tracks all API requests that modify your data:

  • Monitors write operations (POST, PUT, PATCH, DELETE) through your API
  • Learns the relationships between data changes and cached responses
  • Builds a clear understanding of how different endpoints affect each other
  • Targets specific cache entries for invalidation when changes happen

By watching both your database and API activity, SuperAPI delivers a cache that's both fast and accurate, giving you performance benefits without stale data problems.

On this page