litermi/cache-query-builder
最新稳定版本:1.0.60
Composer 安装命令:
composer require litermi/cache-query-builder
包简介
it is a package provider cache from query generate and purge cache when used methods specifics
README 文档
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/cache-query-builder package in your composer.json and update your dependencies:
composer require litermi/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.
统计信息
- 总下载量: 3.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-13