Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Cached Database Stickiness Laravel Package

mpyw/laravel-cached-database-stickiness

Keeps Laravel's read/write database stickiness alive across requests by caching it. After a write, later requests are routed to the primary connection for a set period, preventing stale reads from replicas when using read/write connection splitting.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Scaling read capacity without sacrificing consistency: Enables adoption of read/write database splits (read replicas) for performance, while ensuring that after a write, subsequent reads (even across requests) hit the primary for a configurable window—preventing stale reads that erode user trust.
  • Build vs. buy: Avoids building custom cross-request stickiness logic (cache-backed) on top of Laravel’s built-in per-request sticky option. The package is small, focused, and now explicitly supports Laravel 13/14 and PHP 8.5, reducing maintenance burden.
  • Feature and UX consistency: Critical for flows like profile updates, order placement, or inventory changes where a user must immediately see their own write. Product can confidently ship such features on a read-replica architecture.
  • Roadmap enabler: Supports a roadmap that includes horizontal read scaling or geographic read replicas without introducing eventual-consistency bugs in core user journeys.
  • Use cases: E-commerce checkout/order confirmation, SaaS account settings, social posting (write then immediate feed view), any CRUD app where “my change” must be visible instantly.

When to Consider This Package

  • You use Laravel with read/write connection configuration (read replicas) and observe stale reads after writes, especially when the write and subsequent read happen in different requests.
  • You need stickiness that outlives a single request (Laravel’s native sticky is per-request only) and are comfortable using your cache store to track recent writes.
  • Your consistency requirements are “read-your-writes” for a short TTL (e.g., a few seconds), not full ACID across replicas.
  • You want a maintained, lightweight package rather than custom middleware or event listeners.
  • Look elsewhere if: you run a single database (no replicas), require synchronous replication or strong consistency guarantees beyond a TTL, or cannot accept cache dependency for correctness. Also consider alternatives if you need database-agnostic stickiness across non-Laravel services.

How to Pitch It (Stakeholders)

  • Executives: This package lets us scale reads with replicas without users seeing stale data after they make changes—protecting conversion, trust, and support costs. It’s a small, actively maintained dependency that now supports upcoming Laravel 14 and PHP 8.5, so it won’t block our upgrade roadmap.
  • Engineering: Drop-in solution for cross-request read-after-write consistency on read/write split setups. v2.2.1 confirms CI coverage for PHP 8.5 and composer constraints for Laravel 14 (with Laravel 13 documented), so it’s future-proof and low-risk to adopt. No breaking changes; integrate via cache-backed stickiness with a configurable TTL.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings