PHPackages                             telcolab/cacher - 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. telcolab/cacher

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

telcolab/cacher
===============

A Laravel's package that automatically cache and invalidate Eloquent queries.

v0.2.3(8y ago)4161[1 issues](https://github.com/telcolab/cacher/issues)MITPHPPHP &gt;=7.0

Since Sep 2Pushed 8y ago2 watchersCompare

[ Source](https://github.com/telcolab/cacher)[ Packagist](https://packagist.org/packages/telcolab/cacher)[ Docs](https://github.com/telcolab/cacher)[ RSS](/packages/telcolab-cacher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

Cacher - Caching Eloquent Query
===============================

[](#cacher---caching-eloquent-query)

[![Latest Stable Version](https://camo.githubusercontent.com/b25275cc83c74915b9cb5078048952e90e2284b91742718c14930cfe84e98248/68747470733a2f2f706f7365722e707567782e6f72672f74656c636f6c61622f6361636865722f762f737461626c65)](https://packagist.org/packages/telcolab/cacher) [![Latest Unstable Version](https://camo.githubusercontent.com/e4337bf0fc2c26895d754c35d7f7ec1894235c66f1a3e4d3e0955b2769a38742/68747470733a2f2f706f7365722e707567782e6f72672f74656c636f6c61622f6361636865722f762f756e737461626c65)](https://packagist.org/packages/telcolab/cacher) [![Total Downloads](https://camo.githubusercontent.com/19dbefa9cd3b590464b854a766593255f4afe0dfaa69c81ad930600e912e8975/68747470733a2f2f706f7365722e707567782e6f72672f74656c636f6c61622f6361636865722f646f776e6c6f616473)](https://packagist.org/packages/telcolab/cacher) [![License](https://camo.githubusercontent.com/3e793baf75e03aa1e1820594d2d010e5297be3fc2ec1d167c57f4f6f56709f73/68747470733a2f2f706f7365722e707567782e6f72672f74656c636f6c61622f6361636865722f6c6963656e7365)](https://packagist.org/packages/telcolab/cacher)

Cacher is a package that automatically cache Eloquent query. With **Cacher** it's super easy to cache all eloquent query **including relationships**.

This package works by checking if the query hasn't been executed &amp; cached before and if it doesn't, it will execute the SQL query generated by Eloquent and cache the results. If the query has been cached previously it'll just retrieve it from cache store instead of database.

### Requirements

[](#requirements)

- PHP &gt;= 7
- Laravel &gt;= 5.1
- Taggable Cacher Driver - Redis/Memcached

### Installation

[](#installation)

Install using Composer, just as you would anything else.

```
composer require telcolab/cacher
```

After the installation is completed just open up your Model and use `TelcoLAB\Cacher\Traits\Cacheable` trait. Let's say you have a model name `App\Post`.

```
