go-rejson icon indicating copy to clipboard operation
go-rejson copied to clipboard

Using JSON.SET with expiry

Open jatinsandilya opened this issue 6 years ago • 5 comments

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.

jatinsandilya avatar Aug 08 '19 10:08 jatinsandilya

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 avatar Sep 01 '19 10:09 Shivam010

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.

Shivam010 avatar Sep 01 '19 10:09 Shivam010

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

jatinsandilya avatar Sep 08 '19 07:09 jatinsandilya

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.

nitishm avatar Dec 23 '19 15:12 nitishm

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

On Mon, 23 Dec, 2019, 8:57 PM Nitish Malhotra, [email protected] 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

Shivam010 avatar Dec 23 '19 15:12 Shivam010