Znuny icon indicating copy to clipboard operation
Znuny copied to clipboard

Add Redis cache backend - System::Cache::Redis.

Open ymyasoedov opened this issue 3 years ago • 9 comments

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.(❗)

ymyasoedov avatar Aug 15 '21 12:08 ymyasoedov

👍

rkaldung avatar Aug 17 '21 08:08 rkaldung

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 for System/Redis.pm.
  • [ ] Create a UnitTest scripts/test/Cache/Redis.t for System/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 👍🏼

dennykorsukewitz avatar Aug 20 '21 16:08 dennykorsukewitz

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 avatar Sep 01 '21 17:09 bschmalhofer

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.

rkaldung avatar Sep 01 '21 17:09 rkaldung

@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.

bschmalhofer avatar Sep 01 '21 17:09 bschmalhofer

Hi @ymyasoedov

what's the status here? Do you have any questions or need help?

best 🚀

dennykorsukewitz avatar Sep 08 '22 13:09 dennykorsukewitz

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.

ymyasoedov avatar Sep 09 '22 18:09 ymyasoedov

Hi

This branch has conflicts that must be resolved.

Thank you! :rocket:

dennykorsukewitz avatar Mar 29 '23 08:03 dennykorsukewitz

We will keep this PR open and hope for help from another developer to assist the contributor to meet the requirements.

dignin avatar May 17 '23 09:05 dignin