{"repo":"Laragear/CacheQuery","free":true,"listed":false,"github":"https://github.com/Laragear/CacheQuery","clone":"git clone https://github.com/Laragear/CacheQuery.git","description":"Remember your query results using only one method. Yes, only one.","language":"PHP","stars":272,"topics":["laravel","cache","eloquent","php","caching","database"],"license":"MIT","category":"databases-storage","readme_excerpt":"Cache Query Remember your query results using only one method. Yes, only one. Become a sponsor Your support allows me to keep this package free, up-to-date and maintainable. Alternatively, you can spread the word in social media Requirements PHP 8.3 Laravel 12 or later Installation You can install the package via composer: How does it work? This library wraps the database connection into a proxy object. It proxies all method calls to it except select() and selectOne() . Once a SELECT statement is executed through the aforementioned methods, it will check if the results are in the cache before executing the query. On cache hit, it will return the cached results, otherwise it will continue execution, save the results using the cache configuration, and return them. Usage Use the cache() method to remember the results of a query for a default of 60 seconds. The next time you call the same query, the result will be retrieved from the cache instead of running the SELECT SQL statement in the database, even if the results are empty, null or false . You may also desire to not cache empty results. It's eager load aware . This means that it will cache an eager loaded relation automatically (but you may also disable this). Time-to-live By default, results of a query are cached by 60 seconds, which is mostly enough when your application is getting hammered with the same query results. You're free to use any number of seconds from now, or a DateTimeInterface like Carbon. You can also use n","default_branch":null,"files":null,"tree":[],"storefront":"/r/Laragear","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Laragear/CacheQuery/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."}