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

Cache Query Laravel Package

laragear/cache-query

Cache your Laravel Eloquent queries and get fast, consistent results without hitting the database on every request. It hooks into the query builder, so you can cache models, counts, and relationships with a simple chainable call.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Performance and scalability roadmap bets. A single-call ->cache() wrapper on Eloquent queries gives the team a low-friction way to cut database load on read-heavy screens (dashboards, catalogs, search results, feeds) without standing up a bespoke caching layer. This is a concrete lever when the roadmap says "reduce p95 latency" or "survive traffic spikes without a DB upgrade."
  • Build vs. buy (adopt) decisions. Rather than budgeting engineering weeks for a custom query-cache abstraction, this package is a candidate to adopt under MIT—letting the team spend that capacity on differentiating product work. It is a defensible "adopt open source" recommendation if the team's caching needs are query-shaped and invalidation is manageable.
  • Feature enablement for data-heavy surfaces. Reporting pages, admin analytics, and public listing pages that re-run the same expensive queries can ship sooner and cheaper when caching is a one-line change instead of a cross-cutting architectural project.
  • Scope decisions on caching ownership. It clarifies who owns caching (the query layer) versus app-wide cache strategy, which informs whether caching is an application concern or a platform/infra concern on the roadmap.
  • Prioritization of performance backlog items. Because the integration cost is low, it lets you sequence "quick-win caching" ahead of larger investments (read replicas, query optimization sprints, CDN strategy) and defer the expensive work until evidence justifies it.
  • Risk/technical-debt decisions. A single, well-understood caching mechanism reduces bespoke caching sprawl; the PM trade-off is accepting a third-party dependency with a small maintainer base (272 stars, 0 tracked dependents), its release cadence, and the migration burden implied by a v5 → v6 major-version jump.

When to Consider This Package

Adopt when:

  • The application is Laravel/Eloquent-centric and queries are the natural cache boundary.
  • Workloads are read-heavy with repeated, expensive, and relatively stable queries (catalogs, reports, listings, leaderboards).
  • Cache invalidation can be modeled simply—data changes on a predictable schedule or tolerates short staleness.
  • You want fast, measurable wins (lower query volume, better p95) with minimal engineering lift.
  • The team is comfortable owning a small dependency and pinning versions. Ongoing release activity supports maintenance confidence, but note the v6.0.0 major release now current—plan an upgrade/migration spike (breaking changes are implied by the semver major bump) before adopting, and pin to a tested version.
  • You need a stopgap while longer-term architecture (read replicas, CQRS, materialized views) is scoped.

Look elsewhere when:

  • Data must be real-time or near-real-time; stale reads are a product or compliance problem.
  • Invalidation is genuinely complex (cross-model, event-driven, multi-tenant) and a one-method abstraction would obscure correctness risks.
  • The workload is write-heavy or already DB-bottlenecked in ways caching query results won't fix.
  • You need a managed, centrally-governed cache strategy (shared Redis topology, cross-service consistency, observability/eviction policy ownership) that belongs at the platform layer.
  • The app is small enough that caching is premature optimization, or the team lacks the maturity to reason about TTLs and cache keys.
  • You require enterprise support, SLAs, or a large contributor community—this is a lean, single-maintainer-style package.

How to Pitch It (Stakeholders)

To executives: This is a small, free (MIT-licensed) Laravel package that lets our engineers cache database query results with a single line of code. It targets a common cost driver—repeated expensive reads—and offers a fast, low-risk path to lower latency and reduced database spend without a platform rebuild or new vendor contract. It won't fix every performance problem, and it needs disciplined cache-invalidation rules, but it's a cheap, reversible experiment with clear success metrics (query volume, p95 latency, DB cost). Note the package just shipped a v6.0.0 major release; we'll validate the upgrade in a scoped spike and pin the version before rollout.

To engineering: It's an Eloquent query-cache wrapper—adopt it as the default for stable, read-heavy queries and keep custom caching out of the codebase. The trade-offs are explicit: we own TTLs and invalidation correctness, we pin the version given the modest star count and thin dependent base, and we benchmark before/after per surface. v6.0.0 is a semver-major bump, so treat it as a potential breaking change: review the changelog, budget a migration spike, and confirm API compatibility before upgrading. It complements—not replaces—query optimization, indexing, and read-replica work, and it keeps caching logic co-located with the queries it serves.

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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle