varunazad/laravel-query-cache
最新稳定版本:1.0.1
Composer 安装命令:
composer require varunazad/laravel-query-cache
包简介
Automatic query caching for Laravel with intelligent invalidation
README 文档
README
Blazing-fast query optimization for Laravel
✅ Supported Versions
- Laravel: 8.x, 9.x, 10.x
- PHP: 7.4+, 8.0+
🚀 Features
- ⚡ Automatic caching of Eloquent queries
- 💾 Configurable cache durations
- 📈 Tag-based cache invalidation
- 🔄 Support for all Laravel cache drivers
- 📊 Minimal configuration required
- 🔍 Works with existing Laravel applications
- 🧮 Query Cachin with pagination
🚀 Configuration-
Publish the configuration file:
php artisan vendor:publish --provider="VarunAzad\LaravelQueryCache\QueryCacheServiceProvider" --tag="config"
**This will create config/query-cache.php with the following options:**
return [
'default_ttl' => 3600, // Default cache time in seconds
'enabled' => env('QUERY_CACHE_ENABLED', true),
'prefix' => 'query_cache_',
'store' => env('QUERY_CACHE_STORE', null),
];
Basic Uses Caching Queries use Varunazad\QueryCache\Facades\QueryCache; in you controller / Cache a query for 60 minutes $users = User::cache(60)->where('active', true)->get();
// Use default cache time from config
$posts = Post::cache()->with('comments')->get();
Pagination query add this trait in the model use Varunazad\QueryCache\Traits\Cacheable; use Cacheable;
$users = User::with('wallet')->where('status',1)->withCachePaginate(2,60);
return response()->json($users);
📦 Installation
composer require varunazad/laravel-query-cache ---
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-31