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

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

opgginc/rememberable
====================

Query caching for Laravel 5 with jenssegers's MongoDB ORM

3.2.1.0(3y ago)0681MITPHPPHP &gt;=5.4.0CI passing

Since Apr 21Pushed 3y ago3 watchersCompare

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

READMEChangelogDependencies (4)Versions (15)Used By (0)

This is just forked version of rememberable for jenssegers's MongoDB ORM.

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

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

Rememberable is an Eloquent trait for Laravel 5.0+ that brings back the `remember()` query functions from Laravel 4.2. This makes it super easy to cache your query results for an adjustable amount of time.

```
// Get a the first user's posts and remember them for a day.
User::first()->remember(1440)->posts()->get();

```

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.

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

[](#installation)

Install using Composer, just as you would anything else.

```
composer require watson/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.

```
