Skip to content

Wrap Cache::Default in AutoWire fault-tolerance proxies#79

Merged
justinhoward merged 1 commit into
masterfrom
fault-tolerant-cache-by-default
May 29, 2026
Merged

Wrap Cache::Default in AutoWire fault-tolerance proxies#79
justinhoward merged 1 commit into
masterfrom
fault-tolerant-cache-by-default

Conversation

@justinhoward

Copy link
Copy Markdown
Member

Previously, passing cache: nil (or relying on the default) returned Cache::Default.new unwrapped. Because Default can resolve to a non-fault-tolerant Rails.cache, this bypassed the CircuitProxy and FaultTolerantProxy wrappers that the rest of Cache::AutoWire guarantees, leaving the auto-wired cache potentially non-fault-tolerant.

Recurse through wrap with the constructed Default so it is treated like any other supplied backend: fault-tolerant resolutions (Null, ActiveSupport MemoryStore) pass through unchanged, while a non-fault-tolerant Rails.cache now gets the standard proxy stack.

Add specs covering both Default resolutions to pin the behavior.

@justinhoward justinhoward requested a review from wpliao1989 May 29, 2026 18:47
Previously, passing `cache: nil` (or relying on the default) returned
`Cache::Default.new` unwrapped. Because `Default` can resolve to a
non-fault-tolerant `Rails.cache`, this bypassed the `CircuitProxy` and
`FaultTolerantProxy` wrappers that the rest of `Cache::AutoWire`
guarantees, leaving the auto-wired cache potentially non-fault-tolerant.

Recurse through `wrap` with the constructed `Default` so it is treated
like any other supplied backend: fault-tolerant resolutions (Null,
ActiveSupport MemoryStore) pass through unchanged, while a
non-fault-tolerant `Rails.cache` now gets the standard proxy stack.

Add specs covering both `Default` resolutions to pin the behavior.
@justinhoward justinhoward force-pushed the fault-tolerant-cache-by-default branch from c0f19d4 to ed4ec37 Compare May 29, 2026 18:48

@wpliao1989 wpliao1989 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@justinhoward justinhoward merged commit de6b8cf into master May 29, 2026
14 checks passed
@justinhoward justinhoward deleted the fault-tolerant-cache-by-default branch May 29, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants