PHPackages                             amelia/rememberable - 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. amelia/rememberable

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

amelia/rememberable
===================

Query caching for Laravel 5

v2.0.3(9y ago)1026.7k2[1 issues](https://github.com/ameliaikeda/rememberable/issues)MITPHPPHP &gt;=5.6

Since Aug 5Pushed 9y ago2 watchersCompare

[ Source](https://github.com/ameliaikeda/rememberable)[ Packagist](https://packagist.org/packages/amelia/rememberable)[ RSS](/packages/amelia-rememberable/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (3)Versions (8)Used By (0)

Rememberable, Laravel 5 query cache
===================================

[](#rememberable-laravel-5-query-cache)

[![Build Status](https://camo.githubusercontent.com/f0f4b7b7edc4a906bffb64c08fd46869bc4f633a6f71bc986e8cb3e4d1722785/68747470733a2f2f7472617669732d63692e6f72672f616d656c6961696b6564612f72656d656d62657261626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ameliaikeda/rememberable)

Rememberable is an Eloquent trait for Laravel 5.2+ that adds a transparent query cache to your models.

It works by simply remembering the SQL query that was used and storing the result. If the same query is attempted while the cache is persisted it will be retrieved from the store instead of hitting your database again.

Requirements
------------

[](#requirements)

At current, you're required to be using Redis as your cache implementation.

This is planned to be changed in future, and pull requests are welcomed.

PHP 5.6+ is supported.

**Note:** This package will cause your increment/decrement operations on models that use it to fire the `saved` event afterwards. For most people, this should be of no concern, but to disable it, set `protected static $interceptable = false`.

Installation
------------

[](#installation)

Install using Composer, just as you would anything else.

```
composer require amelia/rememberable

```

The easiest way to get started with Eloquent is to create an abstract `App\Model` which you can extend your application models from. In this base model you can import the rememberable trait which will extend the same caching functionality to any queries you build off your model.

```
