0

Is it possible to insert to List/Array with time stamp?

I saw the TIME and would like that a TCP massage using the REDIS protocol will insert value using the first output of the TIME command.
I'm looking for solutions without rappers only using the standard protocol.

Thanks.

Nat Ritmeyer
  • 5,634
  • 8
  • 45
  • 58
user2495766
  • 123
  • 3
  • 15
  • Not possible - you need to send the timestamp (whether it was obtained with Redis' `TIME` or by other means) – Itamar Haber Sep 21 '15 at 16:58
  • Thank you for the replay. I've read your detailed answer on http://stackoverflow.com/questions/27976255/redis-wildcard-delete-script-using-eval-scan-and-del-returns-write-commands-n Yet when I saw this Lua based solution I feel I'm missing something.. http://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-using-redis – user2495766 Sep 22 '15 at 09:35
  • 1
    `TIME` is a random command so you can't use it from a Lua script that attempts to write afterwards – Itamar Haber Sep 22 '15 at 09:42
  • Thank you! based on your answer I've found it in the documentation: "Things like using the system time, calling Redis random commands like RANDOMKEY, or using Lua random number generator, could result into scripts that will not always evaluate in the same way." – user2495766 Sep 22 '15 at 10:04
  • Would you advice against keeping a key with the time-stamp when the resolution which is needed is seconds? the key can be updated once a sec.. – user2495766 Sep 22 '15 at 10:11
  • 1
    Not at all - use timestamps to your heart's delight, but there isn't a way to do it in one call... just pass the timestamp from the client :) – Itamar Haber Sep 22 '15 at 12:19

0 Answers0