elkarte / Elkarte

ElkArte Forum. A free, open source, modern discussion forum / BB
https://elkarte.github.io/Elkarte/
BSD 3-Clause "New" or "Revised" License
175 stars 61 forks source link

First commit of redis cache utilising predis #3708

Closed tinoest closed 3 months ago

tinoest commented 1 year ago

@Spuds not sure if you want this as part of the core, or if I am doing this the right way.

The ip for the redis server is hardcoded currently, so if you do a checkout edit this line to what your ip is to get it working.

$this->obj = new \Predis\Client('tcp://172.19.0.5:6379');

I will change and work out how to add multiple different servers if you are happy using predis. It seems to work ok otherwise.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 53.33% and project coverage change: +0.17 :tada:

Comparison is base (c5730e1) 30.45% compared to head (fa128c0) 30.62%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## development #3708 +/- ## ================================================= + Coverage 30.45% 30.62% +0.17% - Complexity 16416 16445 +29 ================================================= Files 429 430 +1 Lines 84387 84372 -15 ================================================= + Hits 25703 25843 +140 + Misses 58684 58529 -155 ``` | [Impacted Files](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte) | Coverage Δ | | |---|---|---| | [...rces/ElkArte/AdminController/ManageAttachments.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL0FkbWluQ29udHJvbGxlci9NYW5hZ2VBdHRhY2htZW50cy5waHA=) | `8.74% <ø> (ø)` | | | [sources/ElkArte/AdminController/ManageFeatures.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL0FkbWluQ29udHJvbGxlci9NYW5hZ2VGZWF0dXJlcy5waHA=) | `18.25% <0.00%> (ø)` | | | [sources/ElkArte/AttachmentsDirectory.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL0F0dGFjaG1lbnRzRGlyZWN0b3J5LnBocA==) | `9.90% <ø> (ø)` | | | [sources/ElkArte/Controller/Attachment.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL0NvbnRyb2xsZXIvQXR0YWNobWVudC5waHA=) | `9.58% <0.00%> (ø)` | | | [sources/ElkArte/Controller/Groups.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL0NvbnRyb2xsZXIvR3JvdXBzLnBocA==) | `29.48% <0.00%> (ø)` | | | [sources/ElkArte/Controller/ModerateAttachments.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL0NvbnRyb2xsZXIvTW9kZXJhdGVBdHRhY2htZW50cy5waHA=) | `0.00% <0.00%> (ø)` | | | [sources/ElkArte/Controller/Stats.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL0NvbnRyb2xsZXIvU3RhdHMucGhw) | `0.00% <0.00%> (ø)` | | | [sources/ElkArte/Modules/Attachments/Display.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL01vZHVsZXMvQXR0YWNobWVudHMvRGlzcGxheS5waHA=) | `100.00% <ø> (ø)` | | | [sources/ElkArte/Modules/Random/Display.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL01vZHVsZXMvUmFuZG9tL0Rpc3BsYXkucGhw) | `83.33% <ø> (ø)` | | | [sources/ElkArte/SettingsForm/SettingsForm.php](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte#diff-c291cmNlcy9FbGtBcnRlL1NldHRpbmdzRm9ybS9TZXR0aW5nc0Zvcm0ucGhw) | `100.00% <ø> (ø)` | | | ... and [16 more](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte) | | ... and [11 files with indirect coverage changes](https://app.codecov.io/gh/elkarte/Elkarte/pull/3708/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=elkarte)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

Spuds commented 3 months ago

I picked the Redis.php file from this PR and renamed it to Predis.php because I also added a method to use the pecl phpredis extension.

I'm still unsure what to do about the predis libray itself. I'm inclined to add that to composer and start using the vendor library in place of the ext library going forward. Then this would be added to the suggest section and the core would only have the single interface file to translate elk speak to predis speak.

Also sorry this took me so long to get to, life happens!

Spuds commented 3 months ago

For completeness, the new PR is https://github.com/elkarte/Elkarte/pull/3801

It has both methods and also adds (back again) the cache password and UID values as Redis can have auth() enabled so we need to support that. I did not add that to the predis method just yet but did test it with phpredis

Spuds commented 3 months ago

Closed as this was incorporated in https://github.com/elkarte/Elkarte/pull/3801