nitishm / go-rejson

Golang client for redislabs' ReJSON module with support for multilple redis clients (redigo, go-redis)
MIT License
343 stars 47 forks source link

Using JSON.SET with expiry #36

Open jatinsandilya opened 5 years ago

jatinsandilya commented 5 years ago

Is your feature request related to a problem? Please describe.

As described here https://github.com/RedisJSON/RedisJSON/issues/56. I want to set a json key with some expiry. However, I understand it is not supported by ReJSON directly how could I use go-rejson to solve this? Is this supported ? If not I would be willing to help out. Any pointers would be helpful.

Describe the solution you'd like A command like JSONSetWithExpiry to set expiry for a JSON Key.

Describe alternatives you've considered I guess I could accomplish this using the underlying redis client but since I will be using your library, a method like JSONSetWithExpiry would be a nice abstraction.

Shivam010 commented 5 years ago

I like the idea, and I think we have to use pipelined transactions, for something like this:

MULTI
JSON.SET foo ...
EXPIRE foo 60
EXEC

What do you propose? @jats22 @nitishm

Shivam010 commented 5 years ago

Also, if we can try for a generic method to run any command in an external transaction, that would solve the issue and would be much useful.

I don't know how we should do so in a generic way with different clients, but it's worth a discussion.

jatinsandilya commented 5 years ago

@Shivam010 I really think a generic method would be great! Let me put some thought into it and get back.

nitishm commented 4 years ago

I don't think we want to support this. The Client is supposed to be dumb and should only support what the ReJSON spec provides.

With that said, a generic command to extend the Client is a good idea though. Even if it requires a rewrite we should support this. It is beneficial to support the fundamental features of the client which utilizing the ReJSON features.

Shivam010 commented 4 years ago

So, what do you propose? A transaction method or a expiry method...

On Mon, 23 Dec, 2019, 8:57 PM Nitish Malhotra, notifications@github.com wrote:

I don't think we want to support this. The Client is supposed to be dumb and should only support what the ReJSON spec provides.

With that said, a generic command to extend the Client is a good idea though. Even if it requires a rewrite we should support this. It is beneficial to support the fundamental features of the client which utilizing the ReJSON features.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub