How It Works Pricing Benchmarks
vs Redis Docs Blog
Start Free Trial
Cache Coherence

Service A Writes. Service B Knows.
Automatically.

When any Cachee instance writes or deletes a key, every other instance invalidates its local copy instantly. Zero code. Zero pub/sub wiring. Zero stale data across services.

Automatic
Cross-Service Sync
Zero
Code Required
<1ms
Propagation
Zero
Stale Windows
The Problem

The Microservices Staleness Problem

Microservices cache aggressively because they have to. Every service keeps a local copy of the data it needs to avoid round-tripping to a shared database on every request. But the moment one service updates a record, every other service holding a cached copy of that record is silently wrong.

The pattern is always the same. Service A caches a user profile. Service B processes a name change and writes the update to the database. Service A has no idea. It keeps serving the old name for minutes, sometimes hours, until the TTL expires. Users see inconsistent data depending on which service handles their next request.

Every team solves this differently. One team wires up Redis pub/sub. Another team builds a webhook listener. A third team polls the database every 30 seconds. None of these approaches talk to each other. The result is a patchwork of invalidation logic scattered across services, impossible to audit, and guaranteed to have gaps.

🚨
Staleness Is Silent
Stale cache reads do not throw errors. They return data that looks perfectly valid but is outdated. No logging, no alerting, no indication that the response is wrong. The only signal is a confused user who sees their old email address after updating it five minutes ago.
🔍
Hard to Detect, Impossible to Debug
When a user reports inconsistent data, which service served the stale read? Which cache layer held the old copy? How long was it stale? In a 20-service architecture with per-service caching, answering these questions requires correlating logs across multiple services, cache layers, and time windows. Most teams cannot reproduce the bug because the TTL has already expired by the time they investigate.
How It Works

How Cache Coherence Works

Every Cachee instance in a namespace is automatically connected to a coherence channel. When a write or delete happens on any instance, a lightweight invalidation event propagates to all other instances. The affected key is evicted from every L1 cache before the next read can return stale data.

Coherence Propagation Flow
Service A (Writer)
cache.set("user:42", data)
Writes key → emits invalidation event
Coherence Channel
Dedup + broadcast
Service B
Evicts user:42
Next read fetches fresh data
Service C
Evicts user:42
Next read fetches fresh data
End-to-End Propagation
<1ms
Write to full cluster invalidation, including deduplication
Instant Eviction
The invalidation event arrives at each instance within sub-millisecond latency. The stale key is removed from the local L1 cache immediately. The next read triggers a fresh fetch from the origin, populating L1 with the current value.
Sub-ms propagation
🔄
Built-in Deduplication
If multiple services write the same key simultaneously, the coherence channel deduplicates the invalidation events. Each receiving instance processes exactly one eviction per key per event window. No re-broadcast loops, no cascading invalidations, no thundering herds.
Zero duplicate events
🔒
Namespace Isolation
Coherence events only propagate within a namespace. Service groups that share data share a namespace and get automatic sync. Unrelated services in different namespaces are completely isolated. No cross-contamination, no accidental evictions.
Per-namespace scoping

The coherence channel is not a separate service to deploy. It is built into every Cachee instance. When you connect multiple instances to the same namespace, coherence is active by default. There is no flag to enable, no topic to configure, no subscription to manage. The protocol handles ordering, deduplication, and failure recovery internally. Learn more about the underlying caching architecture.

Comparison

What This Replaces

Every team that runs microservices with local caching eventually builds some form of invalidation. Here is what that typically looks like compared to Cachee coherence.

Aspect Manual Pub/Sub Invalidation Cachee Coherence
Setup Time Weeks per service pair Zero (built-in)
Infrastructure Redis pub/sub, Kafka, or custom webhooks None additional
Code Changes Publisher + subscriber per service Zero application code
Deduplication Manual (easy to miss) Automatic, protocol-level
Failure Handling Custom retry logic per service Built-in with TTL fallback
Cross-Team Coordination Every team agrees on topics, schemas, retry policy Share a namespace, done
Propagation Latency 10-100ms (depends on broker) <1ms
Consistency Gap Varies (message queue delay + consumer lag) Near-zero (sub-ms eviction)

No Shared Redis Required

Traditional invalidation patterns require a shared message broker that every service connects to. This introduces a single point of failure, adds network latency to every invalidation, and requires every team to agree on topic naming, message formats, and retry semantics. Cachee eliminates this entirely. The coherence channel is peer-to-peer within the Cachee mesh. No central broker, no shared Redis instance, no Kafka cluster to maintain.

No Webhooks, No Polling

Some teams skip message brokers and use HTTP webhooks or database polling instead. Webhooks are brittle: they require endpoint registration, authentication, retry logic, and dead-letter handling for each service pair. Polling is wasteful: it burns CPU and database connections checking for changes that may not exist. Cachee coherence is push-based and event-driven, with zero wasted work and zero infrastructure to configure.

See how Cachee compares to other caching approaches in our detailed comparison.

Use Cases

Where Coherence Solves Real Problems

Cache coherence is not a theoretical improvement. These are the concrete scenarios where stale data causes user-visible bugs, and coherence eliminates them.

01
User Profile Updates
A user changes their display name in the account service. The feed service, notification service, and chat service all cache the old name. With coherence, all three evict the stale profile within sub-ms. The next render shows the updated name everywhere.
02
Inventory Sync
The order service decrements stock when a purchase completes. The product listing service, search service, and recommendation engine all hold cached inventory counts. Coherence ensures every service sees the updated count immediately, preventing overselling.
03
Permission Changes
An admin revokes a user's access in the IAM service. The API gateway, file service, and admin dashboard all cache the old permission set. Coherence evicts the stale permissions instantly, closing the window where a revoked user can still access resources.
04
Configuration Propagation
A feature flag is toggled in the config service. Every downstream service caching that flag value sees the update immediately. No restart required, no polling interval to wait for, no deploy needed. The new configuration takes effect cluster-wide in under a millisecond.
05
Session Invalidation
A user logs out or an admin force-terminates a session. The auth service invalidates the session token. Every service that cached the session for fast auth checks evicts it simultaneously. No stale session can be used to access any endpoint after invalidation.
06
Price and Catalog Updates
The pricing service updates a product's price or the catalog service marks an item as discontinued. Every service rendering product data, checkout pages, and invoice calculations sees the updated price immediately. Zero risk of charging the wrong amount.
Integration

Coherence Is Already On

There is no configuration step. If two Cachee instances share a namespace, they are coherent. Write from one, the other knows.

// Service A — writes a key import { Cachee } from '@cachee/sdk'; const cache = new Cachee({ apiKey: 'ck_live_your_key_here', namespace: 'ns_prod_main', }); // This write automatically triggers coherence events await cache.set('user:42', { name: 'Updated Name' }); // Every other instance in ns_prod_main evicts user:42 immediately
// Service B — same namespace, different service import { Cachee } from '@cachee/sdk'; const cache = new Cachee({ apiKey: 'ck_live_your_key_here', namespace: 'ns_prod_main', // same namespace = coherent }); // After Service A writes, this returns fresh data (not stale) const user = await cache.get('user:42'); // { name: 'Updated Name' } // L1 was evicted by coherence event, fresh value fetched from origin
Deletes Propagate Too
When any instance calls cache.del('key'), the coherence channel broadcasts the deletion. Every instance evicts the key from L1. No ghost data, no phantom reads after deletion.
Works With Predictive Caching
Coherence integrates with Cachee's predictive caching layer. After eviction, the ML model can pre-warm the updated value if it predicts an imminent read, reducing the post-eviction cold-read penalty to near zero.
FAQ

Frequently Asked Questions

Does coherence add latency to writes?

The coherence event is emitted asynchronously after the write completes. Your write latency is unchanged. The invalidation propagates in the background and completes within sub-ms, but it does not block the writing service.

What happens during a network partition?

If an instance is temporarily unreachable, it cannot receive coherence events. In this case, the instance falls back to TTL-based expiration as a safety net. Once connectivity is restored, a key-state reconciliation runs automatically. No data is permanently stale.

Can I disable coherence for specific keys?

Yes. If a key is local-only and should not trigger cross-service invalidation, you can set it with the local: true option. Local keys live only in the writing instance's L1 cache and are invisible to the coherence channel.

How does coherence scale with hundreds of instances?

The coherence channel uses a fan-out model optimized for large clusters. Invalidation events are lightweight (key hash + sequence number, no payload). Even at 500+ instances, propagation stays under 1ms. The protocol is bandwidth-efficient because it sends eviction signals, not the data itself.

Is coherence compatible with multi-region deployments?

Yes. Cross-region coherence uses the same protocol with region-aware routing. Propagation latency between regions depends on network distance but typically stays under 50ms for cross-continental deployments. Within a region, sub-ms propagation is maintained.

Stop Building Invalidation
for Every Service.
Turn It On Once.

Every microservice you add is another invalidation gap waiting to happen. Cachee coherence closes all of them at once. Start with the free tier and see cross-service sync working in under five minutes.

Start Free Trial Talk to Enterprise Sales