Znuny
Znuny copied to clipboard
Add Redis cache backend - System::Cache::Redis.
Proposed change
This PR adds a new cache backend based on Redis.
Additional information
Checklist
- [x] The code change is tested and works locally.(❗)
- [ ] There is no commented out code in this PR.(❕)
- [ ] You improved or added new unit tests.(❕)
- [ ] Local ZnunyCodePolicy run passes successfully.(❕)
- [ ] Local unit tests pass.(❕)
- [ ] GitHub workflow ZnunyCodePolicy passes.(❗)
- [ ] GitHub workflow unit tests pass.(❗)
👍
Hi @ymyasoedov,
cool that you took the time and built a new cache backend. :rocket: We appreciate that very much.
So... that we can use the backend in the future, you have to complete a few tasks.
- [ ] Create a
System/Redis.pm
(like following). We need a wrapper for all Redis functions to distinguish between OTRS and Redis.
# examples:
System/JSON.pm
System/Storable.pm
System/VirtualFS.pm
System/XML.pm
System/YAML.pm
# Redis function you used.
$Self->{Redis}->del();
$Self->{Redis}->flushdb();
$Self->{Redis}->get();
$Self->{Redis}->sadd();
$Self->{Redis}->scan();
$Self->{Redis}->select();
$Self->{Redis}->set();
$Self->{Redis}->smembers();
- [ ] Change
System/Cache/Redis.pm
according to the wrapper. - [ ] Create a UnitTest
scripts/test/Redis.t
forSystem/Redis.pm
. - [ ] Create a UnitTest
scripts/test/Cache/Redis.t
forSystem/Cache/Redis.pm
. - [ ] Use ZnunyCodePolicy to optimize code / readability.
- [ ] What is the difference between RedisFast and Redis? RedisFast sounds better already.
If you have any questions or need assistance, let me know. We and the community will help.
best regards 👍🏼
Hi,
this patch adds Redis support via the Perl modules Redis or Redis::Fast. Another idea is to provide generic support for CHI, https://metacpan.org/pod/CHI, and then use CHI::Driver::Redis. This would allow easy integration of other caching modules.
Hi,
this patch adds Redis support via the Perl modules Redis or Redis::Fast. Another idea is to provide generic support for CHI, https://metacpan.org/pod/CHI, and then use CHI::Driver::Redis. This would allow easy integration of other caching modules.
@bschmalhofer Nice idea to have a generic caching layer. Do you have any experience regarding performance? As far as I see it's another layer we add when using CHI.
@bschmalhofer Nice idea to have a generic caching layer. Do you have any experience regarding performance? As far as I see it's another layer we add when using CHI.
I haven't used CHI myself, but it sound like the normal thing to to. I took a quick look at the code of CHI::Driver::Redis and as expected it looks like a simple wrapper of the module Redis. My guess is that the performance hit would not be noticable. We are considering CHI for OTOBO, but of course this change has no high priority, https://github.com/RotherOSS/otobo/issues/107.
Hi @ymyasoedov
what's the status here? Do you have any questions or need help?
best 🚀
Hi!
Unfortunately, I haven't enough free time for that activity. I've proposed my module as it is. Beside that, I don't see any valuable benefit of making that additional abstraction layer with reduced API compared to original Redis (or Redis::Fast) module, it won't add neither additional functionality nor convenience. Redis has its own good set of unit tests, and it looks like an unneeded duplication of work.
Hi
This branch has conflicts that must be resolved.
Thank you! :rocket:
We will keep this PR open and hope for help from another developer to assist the contributor to meet the requirements.