Merge pull request #1137 from denisdulici/master

Model caching
This commit is contained in:
Denis Duliçi 2020-01-18 13:02:08 +03:00 committed by GitHub
commit 03d30cda4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 324 additions and 105 deletions

View File

@ -5,12 +5,13 @@ namespace App\Abstracts;
use App\Scopes\Company;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\SoftDeletes;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
use Kyslik\ColumnSortable\Sortable;
use Lorisleiva\LaravelSearchString\Concerns\SearchString;
abstract class Model extends Eloquent
{
use SearchString, SoftDeletes, Sortable;
use Cachable, SearchString, SoftDeletes, Sortable;
protected $dates = ['deleted_at'];

View File

@ -28,6 +28,7 @@
"dingo/api": "2.4.*",
"doctrine/dbal": "2.9.*",
"fideloper/proxy": "4.2.*",
"genealabs/laravel-model-caching": "0.7.*",
"guzzlehttp/guzzle": "6.5.*",
"intervention/image": "2.5.*",
"jenssegers/date": "3.5.*",

412
composer.lock generated
View File

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1833d7d2fe4dd91486f71b8f08ffb15d",
"content-hash": "da7fd36fd1e0ebe5d9534e3db6ce40d5",
"packages": [
{
"name": "akaunting/firewall",
"version": "1.2.5",
"version": "1.2.6",
"source": {
"type": "git",
"url": "https://github.com/akaunting/firewall.git",
"reference": "924529c4ae1db454745aa59a2731679e8ff287b8"
"reference": "b6a3850cd2accaafd142f2d05e7a2f56b06454fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/akaunting/firewall/zipball/924529c4ae1db454745aa59a2731679e8ff287b8",
"reference": "924529c4ae1db454745aa59a2731679e8ff287b8",
"url": "https://api.github.com/repos/akaunting/firewall/zipball/b6a3850cd2accaafd142f2d05e7a2f56b06454fb",
"reference": "b6a3850cd2accaafd142f2d05e7a2f56b06454fb",
"shasum": ""
},
"require": {
@ -67,7 +67,7 @@
"waf",
"xss"
],
"time": "2020-01-04T18:36:44+00:00"
"time": "2020-01-16T23:50:11+00:00"
},
{
"name": "akaunting/language",
@ -784,16 +784,16 @@
},
{
"name": "composer/ca-bundle",
"version": "1.2.5",
"version": "1.2.6",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149"
"reference": "47fe531de31fca4a1b997f87308e7d7804348f7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/62e8fc2dc550e5d6d8c9360c7721662670f58149",
"reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/47fe531de31fca4a1b997f87308e7d7804348f7e",
"reference": "47fe531de31fca4a1b997f87308e7d7804348f7e",
"shasum": ""
},
"require": {
@ -836,20 +836,20 @@
"ssl",
"tls"
],
"time": "2019-12-11T14:44:42+00:00"
"time": "2020-01-13T10:02:55+00:00"
},
{
"name": "composer/composer",
"version": "1.9.1",
"version": "1.9.2",
"source": {
"type": "git",
"url": "https://github.com/composer/composer.git",
"reference": "bb01f2180df87ce7992b8331a68904f80439dd2f"
"reference": "7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/composer/zipball/bb01f2180df87ce7992b8331a68904f80439dd2f",
"reference": "bb01f2180df87ce7992b8331a68904f80439dd2f",
"url": "https://api.github.com/repos/composer/composer/zipball/7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb",
"reference": "7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb",
"shasum": ""
},
"require": {
@ -916,28 +916,27 @@
"dependency",
"package"
],
"time": "2019-11-01T16:20:17+00:00"
"time": "2020-01-14T15:30:32+00:00"
},
{
"name": "composer/semver",
"version": "1.5.0",
"version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e"
"reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e",
"reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e",
"url": "https://api.github.com/repos/composer/semver/zipball/c6bea70230ef4dd483e6bbcab6005f682ed3a8de",
"reference": "c6bea70230ef4dd483e6bbcab6005f682ed3a8de",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.5 || ^5.0.5",
"phpunit/phpunit-mock-objects": "2.3.0 || ^3.0"
"phpunit/phpunit": "^4.5 || ^5.0.5"
},
"type": "library",
"extra": {
@ -978,7 +977,7 @@
"validation",
"versioning"
],
"time": "2019-03-19T17:25:45+00:00"
"time": "2020-01-13T12:06:48+00:00"
},
{
"name": "composer/spdx-licenses",
@ -1979,16 +1978,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.13",
"version": "2.1.14",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "834593d5900615639208417760ba6a17299e2497"
"reference": "c4b8d12921999d8a561004371701dbc2e05b5ece"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/834593d5900615639208417760ba6a17299e2497",
"reference": "834593d5900615639208417760ba6a17299e2497",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c4b8d12921999d8a561004371701dbc2e05b5ece",
"reference": "c4b8d12921999d8a561004371701dbc2e05b5ece",
"shasum": ""
},
"require": {
@ -2032,53 +2031,7 @@
"validation",
"validator"
],
"time": "2019-12-30T08:14:25+00:00"
},
{
"name": "erusev/parsedown",
"version": "1.7.4",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35"
},
"type": "library",
"autoload": {
"psr-0": {
"Parsedown": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"description": "Parser for Markdown.",
"homepage": "http://parsedown.org",
"keywords": [
"markdown",
"parser"
],
"time": "2019-12-30T22:54:17+00:00"
"time": "2020-01-05T14:11:20+00:00"
},
{
"name": "fideloper/proxy",
@ -2134,6 +2087,120 @@
],
"time": "2019-12-20T13:11:11+00:00"
},
{
"name": "genealabs/laravel-model-caching",
"version": "0.7.4",
"source": {
"type": "git",
"url": "https://github.com/GeneaLabs/laravel-model-caching.git",
"reference": "aa0253e3a5a6dfc5482b68cb177f50a746c30661"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeneaLabs/laravel-model-caching/zipball/aa0253e3a5a6dfc5482b68cb177f50a746c30661",
"reference": "aa0253e3a5a6dfc5482b68cb177f50a746c30661",
"shasum": ""
},
"require": {
"genealabs/laravel-pivot-events": "^0.2.1",
"illuminate/cache": "^6.0",
"illuminate/config": "^6.0",
"illuminate/console": "^6.0",
"illuminate/container": "^6.0",
"illuminate/database": "^6.0",
"illuminate/http": "^6.0",
"illuminate/support": "^6.0"
},
"require-dev": {
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.3",
"orchestra/testbench": "^4.0",
"orchestra/testbench-browser-kit": "^4.0",
"php-coveralls/php-coveralls": "^2.2",
"phpmd/phpmd": "^2.7",
"phpunit/phpunit": "^8.0",
"predis/predis": "^1.1",
"sebastian/phpcpd": "^4.1",
"squizlabs/php_codesniffer": "^3.4",
"symfony/thanks": "^1.2"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"GeneaLabs\\LaravelModelCaching\\Providers\\Service"
]
}
},
"autoload": {
"psr-4": {
"GeneaLabs\\LaravelModelCaching\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike Bronner",
"email": "hello@genealabs.com"
}
],
"description": "Automatic caching for Eloquent models.",
"time": "2019-12-22T19:33:20+00:00"
},
{
"name": "genealabs/laravel-pivot-events",
"version": "0.2.1",
"source": {
"type": "git",
"url": "https://github.com/GeneaLabs/laravel-pivot-events.git",
"reference": "c31bc7cb6b89741d5d2f52284ddd6f22064e2ed0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GeneaLabs/laravel-pivot-events/zipball/c31bc7cb6b89741d5d2f52284ddd6f22064e2ed0",
"reference": "c31bc7cb6b89741d5d2f52284ddd6f22064e2ed0",
"shasum": ""
},
"require": {
"illuminate/database": "^6.0",
"illuminate/support": "^6.0"
},
"require-dev": {
"orchestra/testbench": "^4.0",
"symfony/thanks": "^1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"GeneaLabs\\LaravelPivotEvents\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike Bronner",
"email": "hello@genealabs.com",
"homepage": "https://genealabs.com",
"role": "Developer"
}
],
"description": "This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.",
"homepage": "https://github.com/fico7489/laravel-pivot",
"keywords": [
"eloquent events",
"eloquent extra events",
"laravel BelongsToMany events",
"laravel pivot events",
"laravel sync events"
],
"time": "2019-09-14T00:26:49+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.5.2",
@ -2888,26 +2955,27 @@
},
{
"name": "laravel/framework",
"version": "v6.9.0",
"version": "v6.11.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "60610be97ca389fa4b959d4d13fb3690970d9fb7"
"reference": "17af23842c259edcfd8c5b9e6a7c86596e040034"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/60610be97ca389fa4b959d4d13fb3690970d9fb7",
"reference": "60610be97ca389fa4b959d4d13fb3690970d9fb7",
"url": "https://api.github.com/repos/laravel/framework/zipball/17af23842c259edcfd8c5b9e6a7c86596e040034",
"reference": "17af23842c259edcfd8c5b9e6a7c86596e040034",
"shasum": ""
},
"require": {
"doctrine/inflector": "^1.1",
"dragonmantank/cron-expression": "^2.0",
"egulias/email-validator": "^2.1.10",
"erusev/parsedown": "^1.7",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"league/commonmark": "^1.1",
"league/commonmark-ext-table": "^2.1",
"league/flysystem": "^1.0.8",
"monolog/monolog": "^1.12|^2.0",
"nesbot/carbon": "^2.0",
@ -2967,14 +3035,13 @@
"filp/whoops": "^2.4",
"guzzlehttp/guzzle": "^6.3",
"league/flysystem-cached-adapter": "^1.0",
"mockery/mockery": "^1.2.3",
"mockery/mockery": "^1.3.1",
"moontoast/math": "^1.1",
"orchestra/testbench-core": "^4.0",
"pda/pheanstalk": "^4.0",
"phpunit/phpunit": "^8.3",
"phpunit/phpunit": "^8.4|^9.0",
"predis/predis": "^1.1.1",
"symfony/cache": "^4.3",
"true/punycode": "^2.1"
"symfony/cache": "^4.3.4"
},
"suggest": {
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).",
@ -2992,6 +3059,7 @@
"league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).",
"league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).",
"moontoast/math": "Required to use ordered UUIDs (^1.1).",
"nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).",
@ -3030,7 +3098,7 @@
"framework",
"laravel"
],
"time": "2019-12-19T18:16:22+00:00"
"time": "2020-01-14T15:12:09+00:00"
},
{
"name": "laravel/tinker",
@ -3163,6 +3231,142 @@
"homepage": "https://laravelcollective.com",
"time": "2019-10-02T00:37:39+00:00"
},
{
"name": "league/commonmark",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "34cf4ddb3892c715ae785c880e6691d839cff88d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/34cf4ddb3892c715ae785c880e6691d839cff88d",
"reference": "34cf4ddb3892c715ae785c880e6691d839cff88d",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": "^7.1"
},
"replace": {
"colinodell/commonmark-php": "*"
},
"require-dev": {
"cebe/markdown": "~1.0",
"commonmark/commonmark.js": "0.29.1",
"erusev/parsedown": "~1.0",
"ext-json": "*",
"michelf/php-markdown": "~1.4",
"mikehaertl/php-shellcommand": "^1.4",
"phpstan/phpstan-shim": "^0.11.5",
"phpunit/phpunit": "^7.5",
"scrutinizer/ocular": "^1.5",
"symfony/finder": "^4.2"
},
"suggest": {
"league/commonmark-extras": "Library of useful extensions including smart punctuation"
},
"bin": [
"bin/commonmark"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"League\\CommonMark\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Colin O'Dell",
"email": "colinodell@gmail.com",
"homepage": "https://www.colinodell.com",
"role": "Lead Developer"
}
],
"description": "PHP Markdown parser based on the CommonMark spec",
"homepage": "https://commonmark.thephpleague.com",
"keywords": [
"commonmark",
"markdown",
"parser"
],
"time": "2020-01-16T01:18:13+00:00"
},
{
"name": "league/commonmark-ext-table",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark-ext-table.git",
"reference": "3228888ea69636e855efcf6636ff8e6316933fe7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark-ext-table/zipball/3228888ea69636e855efcf6636ff8e6316933fe7",
"reference": "3228888ea69636e855efcf6636ff8e6316933fe7",
"shasum": ""
},
"require": {
"league/commonmark": "~0.19.3|^1.0",
"php": "^7.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"phpstan/phpstan": "~0.11",
"phpunit/phpunit": "^7.0|^8.0",
"symfony/var-dumper": "^4.0",
"vimeo/psalm": "^3.0"
},
"type": "commonmark-extension",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"psr-4": {
"League\\CommonMark\\Ext\\Table\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Martin Hasoň",
"email": "martin.hason@gmail.com"
},
{
"name": "Webuni s.r.o.",
"homepage": "https://www.webuni.cz"
},
{
"name": "Colin O'Dell",
"email": "colinodell@gmail.com",
"homepage": "https://www.colinodell.com"
}
],
"description": "Table extension for league/commonmark",
"homepage": "https://github.com/thephpleague/commonmark-ext-table",
"keywords": [
"commonmark",
"extension",
"markdown",
"table"
],
"time": "2019-09-26T13:28:33+00:00"
},
{
"name": "league/flysystem",
"version": "1.0.63",
@ -5121,16 +5325,16 @@
},
{
"name": "seld/phar-utils",
"version": "1.0.1",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/phar-utils.git",
"reference": "7009b5139491975ef6486545a39f3e6dad5ac30a"
"reference": "84715761c35808076b00908a20317a3a8a67d17e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a",
"reference": "7009b5139491975ef6486545a39f3e6dad5ac30a",
"url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/84715761c35808076b00908a20317a3a8a67d17e",
"reference": "84715761c35808076b00908a20317a3a8a67d17e",
"shasum": ""
},
"require": {
@ -5161,7 +5365,7 @@
"keywords": [
"phra"
],
"time": "2015-10-13T18:44:15+00:00"
"time": "2020-01-13T10:41:09+00:00"
},
{
"name": "simshaun/recurr",
@ -7240,16 +7444,16 @@
},
{
"name": "filp/whoops",
"version": "2.7.0",
"version": "2.7.1",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "4c97f814aa2f0dd4d5bedc89181c10ef12c004c5"
"reference": "fff6f1e4f36be0e0d0b84d66b413d9dcb0c49130"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/4c97f814aa2f0dd4d5bedc89181c10ef12c004c5",
"reference": "4c97f814aa2f0dd4d5bedc89181c10ef12c004c5",
"url": "https://api.github.com/repos/filp/whoops/zipball/fff6f1e4f36be0e0d0b84d66b413d9dcb0c49130",
"reference": "fff6f1e4f36be0e0d0b84d66b413d9dcb0c49130",
"shasum": ""
},
"require": {
@ -7297,7 +7501,7 @@
"throwable",
"whoops"
],
"time": "2019-12-29T10:00:00+00:00"
"time": "2020-01-15T10:00:00+00:00"
},
{
"name": "fzaninotto/faker",
@ -7464,16 +7668,16 @@
},
{
"name": "myclabs/deep-copy",
"version": "1.9.4",
"version": "1.9.5",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7"
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7",
"reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef",
"reference": "b2c28789e80a97badd14145fda39b545d83ca3ef",
"shasum": ""
},
"require": {
@ -7508,7 +7712,7 @@
"object",
"object graph"
],
"time": "2019-12-15T19:12:40+00:00"
"time": "2020-01-17T21:11:47+00:00"
},
{
"name": "nunomaduro/collision",
@ -7993,16 +8197,16 @@
},
{
"name": "phpunit/phpunit",
"version": "8.5.1",
"version": "8.5.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "7870c78da3c5e4883eaef36ae47853ebb3cb86f2"
"reference": "018b6ac3c8ab20916db85fa91bf6465acb64d1e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7870c78da3c5e4883eaef36ae47853ebb3cb86f2",
"reference": "7870c78da3c5e4883eaef36ae47853ebb3cb86f2",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/018b6ac3c8ab20916db85fa91bf6465acb64d1e0",
"reference": "018b6ac3c8ab20916db85fa91bf6465acb64d1e0",
"shasum": ""
},
"require": {
@ -8072,7 +8276,7 @@
"testing",
"xunit"
],
"time": "2019-12-25T14:49:39+00:00"
"time": "2020-01-08T08:49:49+00:00"
},
{
"name": "scrivo/highlight.php",

View File

@ -0,0 +1,13 @@
<?php
return [
'cache-prefix' => env('MODEL_CACHE_PREFIX', 'model'),
'enabled' => env('MODEL_CACHE_ENABLED', true),
'use-database-keying' => env('MODEL_CACHE_USE_DATABASE_KEYING', true),
'store' => env('MODEL_CACHE_STORE', 'array'),
];