it is a package provider cache from query generate and purge cache when used methods specifics
cirelramos/cache-query-builder is a Laravel package for it is a package provider cache from query generate and purge cache when used methods specifics.
It currently has 2 GitHub stars and 151 downloads on Packagist (latest version 1.0.17).
Install it with composer require cirelramos/cache-query-builder.
Discover more Laravel packages by cirelramos
or browse all Laravel packages to compare alternatives.
Last updated
The cache-query-builder package allows you to increase the performance and low pressure to database request.
Require the cirelramos/cache-query-builder package in your composer.json and update your dependencies:
composer require cirelramos/cache-query-builder
set provider
'providers' => [
// ...
Cirelramos\Cache\Providers\ServiceProvider::class,
],
The defaults are set in config/cache-query.php. Publish the config to copy the file to your own config:
php artisan vendor:publish --provider="Cirelramos\Cache\Providers\ServiceProvider"
Note: this is necessary to you can change default config
To cache for query you need use extend Class
class Product extends CacheModel
{
}
To cache for query you need use methods: getFromCache or firstCache
return Product::query()
->where('active', ModelConst::ENABLED)
->with($relations)
->getFromCache(['*'], $tags);
if you want purge cache can use methods: saveWithCache, insertWithCache, deleteWithCache
$product = new Product();
$product->saveWithCache();
Product::insertWithCache($values);
$product->deleteWithCache();
Released under the MIT License, see LICENSE.