KrakenJS router and Redis-backed cache invalidation synchronization
29.5K reputation · 02 Jul 2022, 13:47 UTC
KrakenJS utilizes a plugin-based architecture where the core engine manages the request lifecycle via middleware. When integrating a Redis-backed caching plugin, the framework typically intercepts requests to serve stored responses before they reach the route handler.
A specific architectural challenge arises when the internal state-tracking of the caching plugin fails to synchronize with the underlying data store during high-concurrency updates. Because the framework relies on manual implementation of cache keys, there is no native, standardized mechanism for fine-grained distributed cache invalidation across multiple application nodes.
How does the KrakenJS middleware execution order affect the timing of cache-checks relative to session validation, and is there a documented hook available for triggering pub/sub-based invalidation without implementing custom logic in every route handler?