perl-redis icon indicating copy to clipboard operation
perl-redis copied to clipboard

Patch to support RedisTimeSeries commands.

Open ghost opened this issue 6 years ago • 7 comments

RedisTimeSeries https://oss.redislabs.com/redistimeseries/ . character was unsupported but now it works for commands beginning with 'ts'. Assumption made that no other commands begin with 'ts'. usage: $redis->tscreate(....), tsadd(....) etc.

First pull request made so excuse me if I've missed something. No tests written as I'm not sure how to do that.

Not sure the change is good enough but please review.

ghost avatar Jul 23 '19 20:07 ghost

Hi,

Thank you for your contribution. I'm not sure adding a dot after "ts" for all command that start with it is a good long term solution. There are other Redis modules, that all have a dot in the command name. It would be better to have Redis.pm to offer a better support of these "dotted" commands.

I'll check out how other clients do

dams avatar Jul 23 '19 21:07 dams

FYI, $redis->${\"ts.create"} is one of workaround for redis modules. but it looks bad knowhow. I want official support of Redis.pm.

in addition, there are "underlined" commands such asgeoradius_ro https://github.com/PerlRedis/perl-redis/issues/128

shogo82148 avatar Jul 24 '19 04:07 shogo82148

Maybe it’s time to introduce an other API, like $redis->command(‘KEYS’,’*’) ? It would become the main way to use the module, but we’d keep existing methods as shortcuts

dams avatar Jul 24 '19 16:07 dams

Sounds like a viable option I think.

ghost avatar Jul 24 '19 18:07 ghost

It sounds good, but there is already the "command" command https://redis.io/commands/command we should choice new method's name very carefully.

shogo82148 avatar Jul 25 '19 00:07 shogo82148

what would be great at this point is to check how other Perl clients but also other language's clients do. If some of you have used other clients, please share your knowledge/experience

dams avatar Jul 25 '19 07:07 dams

A quick check of how clients for other languages do (from redis client list), yields that some provides a "wrapper" method like Do(..), Command(..) or Execute(..) for commands. Providing meaningful method names such as Set(..), Get(..), Incrby(..) etc. is very common. I believe that implementing a wrapper method like $redis->do(..) or similar as you suggest is the way forward. I don't see that there is any other way if we want to support commands having a dot in their names as (if memory serves) Perl does not support dot chars in sub names.

ghost avatar Jul 25 '19 07:07 ghost