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

Eloquent Autocache Laravel Package

wddyousuf/eloquent-autocache

Automatic, self-invalidating Eloquent query caching. Add one trait and reads are cached transparently while any write flushes the model's cache. Uses cache tags or per-model versioning, so it works on every store.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for caching infrastructure. The package collapses a recurring "we should cache these queries" backlog item into a one-trait adoption. A PM can use it to defer or eliminate a custom caching layer, freeing engineering capacity for differentiated work instead of invalidation plumbing.
  • Performance roadmap sequencing. Automatic, self-flushing query caching is a cheap lever for latency and database load before committing to bigger investments (read replicas, query tuning sprints, horizontal scaling, Redis cluster upgrades). It can serve as a stopgap that buys months of headroom.
  • Feature feasibility for read-heavy surfaces. Dashboards, reporting views, catalog/search listings, public marketing pages, and admin index screens are the natural beneficiaries. If a roadmap item is blocked on "this query is too expensive to run per request," this package is a credible unblocker.
  • Cache-store strategy decisions. The tag-based path (Redis/Memcached) versus the per-model version-counter fallback (file/database/array) is an explicit architectural fork. That makes it a useful forcing function to decide whether the product warrants a tag-capable cache store, and to quantify the cost of not having one.
  • Correctness-versus-freshness product tradeoffs. Row-level caching, relationship-aware invalidation, and stale-while-revalidate are levers a PM can reason about per surface: is a few seconds of staleness acceptable on a product listing (yes) versus an account balance or inventory count (probably not)? This package makes those tradeoffs configurable rather than implicit.
  • Consistency guarantees as a product promise. Because it claims to flush on bulk, raw, and event-suppressing "quiet" writes, it supports decisions about whether data freshness can be guaranteed without hand-written invalidation hooks in every write path — a common source of production incidents and support tickets.
  • Operational surface area. Facade and Artisan commands (inspection/flushing), events, and Octane guidance mean cache behavior can be observed and operated. That supports decisions about on-call runbooks and whether the team can own this in production.

When to Consider This Package

Adopt it for a time-boxed evaluation when all of the following hold:

  • You have a Laravel 10–13 / PHP 8.1+ application with clearly identified read-heavy Eloquent queries and measurable database pressure (slow query logs, p95 latency, connection saturation).
  • Your team has no caching conventions, or has ad-hoc Cache::remember calls with hand-maintained invalidation that keeps drifting stale.
  • You can accept eventual consistency on the affected surfaces, and the configurable stale-while-revalidate window is compatible with your product's freshness expectations.
  • You have a cache store that either supports tags (preferred) or you accept the version-counter fallback's behavior on file/database/array.
  • Someone owns a benchmark: before/after query counts, p95 latency, cache hit rate, and a correctness test suite covering write paths including bulk and raw writes.

Look elsewhere, or treat as high-risk, when:

  • The dependency bar is strict. 41 stars, zero dependents, and maturity signals limited to README, changelog, and releases (no evidence of a substantial test suite or broad production usage) mean single-maintainer and abandonment risk. For a revenue-critical path, that is a real liability.
  • You need vendor support, SLAs, or security review sign-off. There is none here.
  • Correctness is non-negotiable and unverifiable. If you cannot instrument and prove invalidation correctness yourself — multi-tenant scoping, raw DB::statement writes, queue workers, transactions — do not adopt. Silent staleness is worse than slow queries.
  • You already run first-party caching. Laravel's own Cache::remember/rememberForever plus model observers, or a mature package like spatie/laravel-responsecache or watson/rememberable, may cover the need with more community scrutiny.
  • Your bottleneck isn't query repetition. If the problem is a single expensive aggregate query or missing indexes, caching it hides a design problem.

How to Pitch It (Stakeholders)

For executives: This is a small, MIT-licensed Laravel add-on that caches database reads automatically and clears the cache whenever data changes, so we get faster pages and lower database load without building a custom caching system. It is a low-cost experiment, not a platform commitment: one trait on a model, a config file, and a benchmark we can run in a sprint. Expected upside is measurable latency and infrastructure-cost reduction on our read-heaviest screens; downside is bounded because removal is a config revert. The caveat is maturity — it is a young package with a single maintainer and no visible production user base, so we should pilot it on non-critical surfaces, prove invalidation correctness with our own tests, and keep a fallback path to Laravel's built-in cache if it doesn't hold up.

For engineering: The design is sound and pragmatic — cache tags where supported, per-model version counters everywhere else, flush on create/update/delete including bulk, raw, and quiet writes, plus row-level caching, relationship-aware invalidation, and stale-while-revalidate. The ask is a two-week spike: instrument one or two read-heavy models, measure hit rate, query volume, and p95, and write adversarial tests around every write path (raw SQL, mass updates, saveQuietly, queued jobs, multi-tenant scopes, Octane workers). Gate adoption on that evidence, pin the version, and vendor or fork if we go to production.

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.
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo