Download the PHP package curder/laravel-query-cache without Composer
On this page you can find all versions of the php package curder/laravel-query-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-query-cache
Cache all "select" queries or only the duplicate ones for a specific Eloquent model
- Overview
- Installation
- Usage
- Extra
Overview
This package allows you to cache all queries of type select
, or only just the duplicated ones for an Eloquent model.
Please note that because cache tagging is used, "file" or "database" cache drivers are incompatible with this package.
Compatible cache stores: array, redis, apc, memcached
Tested cache stores: array, redis
Installation
Install the package via Composer:
Publish the config file with:
Please read the
config/query-cache.php
config file comments as it contains extra information
Usage
Step 1
Your Eloquent models should use the Neurony\QueryCache\Traits\IsCacheable
trait.
Step 2
In your .env
file add the necessary environment variables:
Depending on how you set your environment variables, the next time you make select
queries on that Eloquent model, after the very first run, the queries will be cached.
Extra
Using the QueryCacheService
class
Please note that the Neurony\QueryCache\Services\QueryCacheService
class is the actual implementation of the Neurony\QueryCache\Contracts\QueryCacheServiceContract
interface.
The Neurony\QueryCache\Services\QueryCacheService
class is bound to the Laravel's IoC as a singleton and aliased as cache.query
.
With that being said, the recommended way of directly using the Neurony\QueryCache\Services\QueryCacheService
is:
Enable / Disable query caching
You can enable or disable all query caching for your current request, by calling the enableQueryCache
or disableQueryCache
methods present on the Neurony\QueryCache\Services\QueryCacheService
class.
Credits
- Andrei Badea
- All Contributors
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see LICENSE for more information.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
All versions of laravel-query-cache with dependencies
illuminate/contracts Version ^7.0|^8.0|^10.0|^11.0
illuminate/support Version ^7.0|^8.0|^10.0|^11.0
illuminate/database Version ^7.0|^8.0|^10.0|^11.0