{"repo":"dwightwatson/rememberable","free":true,"listed":false,"github":"https://github.com/dwightwatson/rememberable","clone":"git clone https://github.com/dwightwatson/rememberable.git","description":"Query caching for Laravel","language":"PHP","stars":1126,"topics":["laravel","php","eloquent","caching"],"license":"MIT","category":"databases-storage","readme_excerpt":"Rememberable, Laravel 5 query cache =================================== Rememberable is an Eloquent trait for Laravel that adds remember() query methods. This makes it super easy to cache your query results for an adjustable amount of time. 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 Install using Composer, just as you would anything else. 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. Now, just ensure that your application models from this new App\\Model instead of Eloquent. Alternatively, you can simply apply the trait to each and every model you wish to use remember() on. [!NOTE] Laravel 13 introduced the serializeable classes cache config which requires to be explicit about which classes can be serialized. You'll likely need to include Illuminate\\Eloquent\\Database\\Collection , Illuminate\\Pagination\\Paginator and the models you cache. I've written more about some of your options here. Usage Using the remember method is super simple. Just pass the number of seconds you want to store the result of that query in the cache for, and whenever the same query is called w","default_branch":null,"files":null,"tree":[],"storefront":"/r/dwightwatson","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dwightwatson/rememberable/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}