Edge Cache Invalidation
Resilis adopts a nuanced approach to cache invalidation, primarily centered around mutation-based invalidation, complemented by strategic use of TTL settings at edge nodes around the world.
Mutation-Based Invalidation as the Core
Mutation-based cache invalidation is at the heart of Resilis’s cache management strategy. It’s particularly effective for dynamic endpoints where data frequently changes. This approach works as follows:
- Create (POST Requests): Adding new data leads to an immediate cache update or invalidation.
- Update (PUT Requests): Modifications to existing data trigger relevant cache entries to be updated or invalidated.
- Delete (DELETE Requests): Removing data results in cache invalidation to prevent serving outdated content.
This method ensures the cache always mirrors the latest data state, crucial for maintaining accuracy and reliability.
Integrating Long TTL with Mutation-Based Invalidation
In Resilis’s system, long TTL values are set for cache entries but with a twist. The long TTL strategy is effectively paired with mutation-based invalidation:
- Long TTL for Efficiency: Cached data is set to expire after an extended period (up to a month), reducing server load and improving response times for stable data.
- Dynamic Invalidation: Despite the long TTL, mutation-based invalidation overrides the TTL settings when data changes occur. This ensures that even with a long TTL, the cache doesn’t hold outdated data.
Short TTL for Endpoints Without Mutation-Based Setup
For endpoints that aren’t configured for mutation-based invalidation, Resilis uses a shorter TTL. This serves as a safety net, ensuring that the cache is regularly refreshed and does not retain stale data for an extended period.
Conclusion
Resilis’s cache invalidation approach is a sophisticated blend of long TTL and mutation-based invalidation. This strategy ensures optimal performance by maintaining up-to-date data in the cache, while also optimizing resource use and response times.