0

I would like to store data like this in Redis #SET datetime:1 "Login time [date] and in hour is [current time]"

How to replace the content in brackets? As we know in SQL we can use getdate() function, but how in Redis?

0

1 Answer 1

2

There is TIME command, but it won't work if you simply pass it as a parameter to SET. You can either to do it programatically in whatever language you are using. Or with a Lua script using EVAL command.

Sign up to request clarification or add additional context in comments.

1 Comment

Note that TIME is a non deterministic command, and as such will cause a Lua script to err upon attenpting a write. You can overcome that, in v3.2 and above, by turning on effects replication instead of the default scripts replication.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.