Weave Code
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 Eloquent Query Cache Laravel Package

vigstudio/laravel-eloquent-query-cache

Add query-level caching back to Eloquent with a simple remember-like API. Cache results from database queries, reduce repeated hits, and integrate with Laravel’s cache stores for faster reads and configurable invalidation.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Performance Optimization: Accelerate read-heavy applications by caching frequent Eloquent query results, reducing database load and improving response times (critical for high-traffic APIs, dashboards, or content-heavy sites).
  • Cost Efficiency: Lower cloud database costs (e.g., AWS RDS, PostgreSQL) by reducing query volume for repetitive data fetches (e.g., product listings, user profiles, or static reports).
  • Build vs. Buy: Avoid reinventing caching logic for Eloquent queries—this package provides a lightweight, Laravel-native solution without heavy dependencies (e.g., Redis or Memcached).
  • Roadmap Prioritization: Justify development resources for caching layers by demonstrating measurable gains in latency/throughput for key user journeys (e.g., "Reduce TTFB for homepage by 30%").
  • Use Cases:
    • Public APIs: Cache responses for rate-limited endpoints (e.g., /products?category=X).
    • Admin Panels: Pre-cache dashboard widgets or user analytics.
    • E-commerce: Cache inventory/product data for high-concurrency periods (e.g., Black Friday).
    • Legacy Systems: Retrofit caching to existing Eloquent models without major refactoring.

When to Consider This Package

  • Adopt if:
    • Your app relies on repetitive read queries (e.g., User::where(...)->get() called >10x/minute).
    • You’re using Laravel Eloquent and need caching without Redis/Memcached overhead (supports file/array drivers by default).
    • Your data is occasionally updated (TTL-based cache invalidation is manual; ideal for "stale-while-revalidate" patterns).
    • You’re in early-stage scaling and want to defer dedicated caching infrastructure (e.g., Redis clusters).
  • Look elsewhere if:
    • Your queries are write-heavy or require real-time consistency (use database-level caching or query optimization instead).
    • You need automatic cache invalidation (e.g., on model updates; consider laravel-cache + event listeners).
    • Your team lacks PHP/Laravel caching expertise (package has minimal docs; requires manual TTL management).
    • You’re using complex relationships (package may not handle with() or nested eager loading optimally).

How to Pitch It (Stakeholders)

For Executives: "This package lets us cache database query results in Laravel with minimal effort—think of it as a ‘turbo boost’ for read-heavy features. For example, if our product catalog API is queried 10,000 times/day, caching could cut database load by 50%, saving costs and speeding up pages. It’s a low-risk way to improve performance without hiring caching specialists or overhauling our stack."

For Engineers: *"The vigstudio/laravel-eloquent-query-cache package adds a simple cache() method to Eloquent queries (e.g., User::where(...)->cache(60)->get()). It supports Laravel’s built-in cache drivers (file, database, Redis) and is ideal for:

  • Quick wins: Cache static or slow queries without Redis setup.
  • Flexibility: Manual TTL control per query (e.g., cache(300) for reports, cache(5) for live data).
  • Integration: Works alongside Laravel’s existing caching layer—no vendor lock-in. Tradeoff: You’ll need to handle cache invalidation manually (e.g., clear cache on model updates). Best for non-critical or batch-heavy data."*
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky