eko / gocache

☔️ A complete Go cache library that brings you multiple ways of managing your caches
https://vincent.composieux.fr/article/i-wrote-gocache-a-complete-and-extensible-go-cache-library/
MIT License
2.42k stars 192 forks source link

Rueidis Store Implementation #182

Closed rwrz closed 1 year ago

rwrz commented 1 year ago

Hello! I've been using GoCache for a while, nice work! But I missed a store for Rueidis, since they are doing an amazing job implementing pipelines to connect to redis. So, I've implemented it plus a simple test and benchmark. I hope it could be a good headstart for who wants to use it as well. My initial benchmark using it, gave me impressive results already.

BenchmarkRueidisSet
BenchmarkRueidisSet/1
BenchmarkRueidisSet/1-12        6609        221181 ns/op
BenchmarkRueidisSet/2
BenchmarkRueidisSet/2-12        2064        498759 ns/op
BenchmarkRueidisSet/4
BenchmarkRueidisSet/4-12        1207       1003580 ns/op
BenchmarkRueidisSet/8
BenchmarkRueidisSet/8-12         602       2601575 ns/op
BenchmarkRueidisSet/16
BenchmarkRueidisSet/16-12        306       3627170 ns/op
BenchmarkRueidisSet/32
BenchmarkRueidisSet/32-12        100      11226917 ns/op
BenchmarkRueidisSet/64
BenchmarkRueidisSet/64-12         74      15380498 ns/op
BenchmarkRueidisSet/128
BenchmarkRueidisSet/128-12                42      37239654 ns/op
BenchmarkRueidisSet/256
BenchmarkRueidisSet/256-12                13      90185656 ns/op
BenchmarkRueidisSet/512
BenchmarkRueidisSet/512-12                10     161984402 ns/op
BenchmarkRueidisSet/1024
BenchmarkRueidisSet/1024-12                5     249825490 ns/op

BenchmarkRueidisGet
BenchmarkRueidisGet/1
BenchmarkRueidisGet/1-12     1587728           779.9 ns/op
BenchmarkRueidisGet/2
BenchmarkRueidisGet/2-12      708728          1543 ns/op
BenchmarkRueidisGet/4
BenchmarkRueidisGet/4-12      383166          3113 ns/op
BenchmarkRueidisGet/8
BenchmarkRueidisGet/8-12      171426          6146 ns/op
BenchmarkRueidisGet/16
BenchmarkRueidisGet/16-12     122622         12512 ns/op
BenchmarkRueidisGet/32
BenchmarkRueidisGet/32-12      57300         25042 ns/op
BenchmarkRueidisGet/64
BenchmarkRueidisGet/64-12      26070         47883 ns/op
BenchmarkRueidisGet/128
BenchmarkRueidisGet/128-12             12382         98872 ns/op
BenchmarkRueidisGet/256
BenchmarkRueidisGet/256-12              5871        197406 ns/op
BenchmarkRueidisGet/512
BenchmarkRueidisGet/512-12              2850        392506 ns/op
BenchmarkRueidisGet/1024
BenchmarkRueidisGet/1024-12             1311        810502 ns/op

Commit logs:

eko commented 1 year ago

Hi, nice work, thank you @rwrz.

Could you also add a little reference to Ruedis in the README.md file please?

eko commented 1 year ago

Hi @rwrz,

I've just released a new major version (v4.0.0) in which I've separated each store cache in a separated Go module.

I've opened a new pull request here for your Rueidis implementation in a separated Go module: https://github.com/eko/gocache/pull/184

I've also added the missing unit tests and the README entry.

Please let me know if you have any issue, elsewhere I will merge it in the following days.

For now, I am closing this pull request in flavor of #184

Thank you :)