🔄 Distributed Mode
For multi-node deployments, ZooCache offers an invalidation bus based on Redis.
Configuration
Enable distributed mode by configuring the bus_url:
configure(
storage_url="redis://redis:6379",
bus_url="redis://redis:6379",
prefix="my_app" # Very important for environment isolation
)
How It Works
- Node A invalidates a tag → publishes a message to Redis Pub/Sub.
- Node B (and others) receive the message → update their local
PrefixTrie. - All related cache entries in all nodes are instantly invalidated.
Self-Healing
What happens if a Redis message is lost? ZooCache is resilient:
- Cache entries store "snapshots" of their dependency versions.
- Upon reading an entry, its versions are compared with the current Trie state.
- If the entry has obsolete versions (or the local Trie is lagging), ZooCache detects the inconsistency and forces an update.
This ensures strong eventual consistency even with messenger bus failures.