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 Model Cache Laravel Package

codewithdennis/laravel-model-cache

Cache Eloquent model queries in Laravel with a single trait. Cached results are automatically invalidated when models are created, updated, or deleted, cutting database load and speeding up repeated reads with minimal setup.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for performance work. This package is a candidate "buy" answer to a specific, recurring backlog item: hot Eloquent read queries are slow and the database is the bottleneck. It lets you test that hypothesis in a spike rather than committing to a quarter of custom caching infrastructure. It does not replace a read-model/materialized-view investment for genuinely high-write domains, so treat it as a scoping tool that deflects a small feature from becoming a platform project.
  • Roadmap sequencing for latency and scale. If p95/p99 read latency or database read load sits on the roadmap, this is a cheap instrument to quantify how much headroom caching buys before you approve vertical scaling or a read replica. The measurement is the deliverable; the package is disposable if the numbers disappoint.
  • Feature velocity on read-heavy surfaces. Catalogue pages, marketing/landing content, settings/reference data, and dashboard aggregates are the classic 90/10 read/write tables where a trait can ship in an afternoon. That buys engineering time back for differentiators, and it's reversible with a config flag.
  • Risk triage on stale-data surfaces. The package makes the definition of acceptable staleness an explicit product question per feature ("is it OK if a published post lags 60 seconds?"). That's a healthy forcing function and a decision the PM should own — but it also means the package creates product obligations, not just engineering ones.
  • Deferring infrastructure spend. A validated rollout can push out a Redis cluster upgrade or a database tier bump by one or two planning cycles. The evidence gate is a measured hit ratio and query-count reduction on a pilot model, not the vendor's claims.
  • Explicitly not supported: multi-tenant SaaS where cross-tenant leakage is possible, payment/inventory/ledger flows where read-after-write must be exact, and any feature where "wrong data, silently, occasionally" is a support-ticket category you can't afford. Those decisions should be closed off before the package is even trialed.

When to Consider This Package

Consider it when all of the following hold:

  • You run a conventional Laravel application on a shared cache backend already in production (Redis or Memcached). Treat Redis as a prerequisite, not a nice-to-have — file/database/array drivers weaken or break tag-based invalidation.
  • You have identified one or two specific, measurable read-hot models — high reads, low writes, staleness tolerable for seconds — and can articulate what "stale" costs the user.
  • Writes to those tables flow through Eloquent instances, so model events fire. Any DB::table() writer, third-party sync job, or raw mass update is a known gap you've mapped and accepted.
  • You can afford a pilot with a config flag and an integration test asserting invalidation, plus a runbook for flushing or disabling under incident.
  • You're willing to pin ^1.0.0-beta.1 exactly and absorb breaking changes before 1.0. It's a single-maintainer, 7-star, pre-1.0 dependency with effectively zero public dependents — no ecosystem validation and no community support safety net. Budget an internal owner, or the willingness to vendor the trait if maintenance lapses.

Look elsewhere when:

  • Correctness is non-negotiable. Ledgers, inventory, checkout, permissions. refresh()/fresh() may return stale data, transaction-commit ordering is unverified, and mass updates bypass invalidation. Use a purpose-built read model instead.
  • Multi-tenancy is in scope. Cache-key scoping for tenant/auth context is undocumented. Until proven with a test that fails loudly, this is a hard blocker.
  • You need vendor guarantees. No SLA, no commercial backing, no visible security disclosure channel — a governance gap for anything in the data-correctness path.
  • You're on Octane or long-lived workers and can't verify compatibility first.
  • You actually need repository- or response-level caching, where Laravel's own Cache::remember gives you more explicit control and no new dependency.
  • You haven't profiled. Caching to hide an N+1 is the wrong fix and makes it permanent. Disable in local/testing (MODEL_CACHE_ENABLED=false) so the problem stays visible.

Default PM stance: approve a timeboxed spike (one model, one branch, measured), not adoption. Adopting a beta package into your data path is a product risk decision, and the score and star count say this is a bet on a small code surface you can read and fork — not on a vendor.

How to Pitch It (Stakeholders)

To executives (30 seconds): We have a cheap, reversible experiment that may cut database load and page latency on our read-heavy pages, and could defer an infrastructure purchase by a cycle or two. It costs days, not weeks, and we can switch it off with a config flag. I'm not asking to adopt it broadly: it's a pre-1.0 package from a single developer with no support, so the recommendation is a measured pilot on one low-risk surface with a clear kill criterion. If the numbers don't show up, we walk away having lost a spike and gained real performance data we'd have needed anyway.

To engineering leads: The insertion point is right — the Eloquent layer, below controllers — so existing query code benefits without restructuring. Installation is trivial; the actual work is deciding which models are safe and proving invalidation holds. The real risks are ranked and concrete: silent staleness on writes that bypass Eloquent, invalidation firing before transaction commit, cache keys that don't scope by tenant, and undocumented behavior when Redis is unavailable. My ask is a one-model pilot behind a flag for a full write cycle, with tests asserting invalidation rather than trusting the docs — they're thin at beta. Also: this only pays off on Redis/Memcached; on the file driver, don't bother.

To the team on the ground: Pin the exact beta version, wrap the cached queries behind your own scopes or repository methods so a rename at 1.0 touches one file, keep the package disabled locally so caching doesn't mask N+1s, and write the runbook before launch — how to flush selectively and how to disable during an incident. This is a small enough codebase that forking is realistic if the maintainer disappears, which is exactly why the risk is manageable for a pilot and unacceptable for a silent, org-wide rollout.

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.
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk