litermi-packages / cache-query-builder
it is a package provider cache from query generate and purge cache when used methods specifics
Package info
github.com/litermi-packages/cache-query-builder
pkg:composer/litermi-packages/cache-query-builder
Requires
- php: ^7.4|^8.0
- illuminate/config: ^6.9|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/console: ^6.9|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/contracts: ^6.9|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/database: ^6.9|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/http: ^6.9|^7.0|^8.0|^9.0|^10.0|^11.0
- kirschbaum-development/eloquent-power-joins: ^2.5|^2.6|^3.5
- litermi-packages/error-notification: ^1.0
- litermi-packages/logs: ^1.0
- litermi-packages/response: ^1.0
- spatie/laravel-query-builder: ^3.6|^5.0|^5.8
This package is auto-updated.
Last update: 2026-06-03 20:02:38 UTC
README
About
The cache-query-builder package allows you to increase the performance and low pressure to database request.
Tutorial how create composer package
Features
- cache query getting columns and values
- cache sub query / relationship
- set time individual by model
- methods to get and first values from cache
- methods to save, insert, delete to cache
Installation
Require the litermi-packages/cache-query-builder package in your composer.json and update your dependencies:
composer require litermi-packages/cache-query-builder
Configuration
set provider
'providers' => [ // ... Litermi\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="Litermi\Cache\Providers\ServiceProvider"
Note: this is necessary to you can change default config
Usage
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();
License
Released under the MIT License, see LICENSE.