PHPackages                             curder/laravel-query-cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. curder/laravel-query-cache

ActiveLibrary[Database &amp; ORM](/categories/database)

curder/laravel-query-cache
==========================

Cache all {select} queries or only the duplicate ones for a specific Eloquent model

6.1.0(2mo ago)01.5k↓100%MITPHPPHP ^8.0

Since Mar 28Pushed 2mo agoCompare

[ Source](https://github.com/curder/laravel-query-cache)[ Packagist](https://packagist.org/packages/curder/laravel-query-cache)[ RSS](/packages/curder-laravel-query-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (11)Used By (0)

### Cache all "select" queries or only the duplicate ones for a specific Eloquent model

[](#cache-all-select-queries-or-only-the-duplicate-ones-for-a-specific-eloquent-model)

[![Build Status](https://camo.githubusercontent.com/2387fe8a477251ebdf707e1467a56c32fecf082d14aa4367ef731fd39ba85291/68747470733a2f2f7472617669732d63692e6f72672f4e6575726f6e792f6c61726176656c2d71756572792d63616368652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Neurony/laravel-query-cache)[![StyleCI](https://camo.githubusercontent.com/9b6a1e4f4f32d0e219a9f163cda5bbd3fda48b59ed12065adaa2667b2219b0ca/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3137373633363034312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/177636041)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6f4fc8721517e8cb44859dcdd461b0d65421a74a2167ebcade609dd2d48bf188/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4e6575726f6e792f6c61726176656c2d71756572792d63616368652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Neurony/laravel-query-cache/?branch=master)

- [Overview](#overview)
- [Installation](#installation)
- [Usage](#usage)
- [Extra](#extra)

### Overview

[](#overview)

This package allows you to cache all queries of type `select`, or only just the duplicated ones for an Eloquent model.

> Please note that because cache tagging is used, "file" or "database" cache drivers are incompatible with this package.
>
> **Compatible cache stores:** array, redis, apc, memcached
> **Tested cache stores:** array, redis

### Installation

[](#installation)

Install the package via Composer:

```
composer require curder/laravel-query-cache

```

Publish the config file with:

```
php artisan vendor:publish --provider="Neurony\QueryCache\ServiceProvider" --tag="config"

```

> Please read the `config/query-cache.php` config file comments as it contains extra information

### Usage

[](#usage)

##### Step 1

[](#step-1)

Your Eloquent models should use the `Neurony\QueryCache\Traits\IsCacheable` trait.

```
