Redis. How to write to the key TimeStamp from the server where the Redis-server is running?

Asked bynancy m

A simple task, but I never found an answer on the Internet.

Records are made to the Redis server from other sites on the Internet using php-rediska.

The date set on these sites naturally can not be trusted. Important per second accuracy.

Answers

vinh nguyen
And about the Redis patch, if you still decide, here's link. You need to create a special kind of argument with placeholders. I would add, $PLACEHOLDER, it turns out that if after $ there is a numeric value, then this is the length of the value and we read it from the new line (that is, how it is happening now). If after $ there is a non-numeric string, then this is a placeholder. In this case, it may be $TIMESTAMP, which says that the argument is the current timestamp. This will also add more place holders in the future (although I can’t think of any). If you need more flexibility, you can use placeholders directly in the values, for example, something like %TIMESTAMP%, but this will make the code back incompatible.
P.S. I would still look in the direction of NTP :)
Replies:
do you offer to patch a binary? or something I do not understand? - susieqlaw
Why a binary? Redis is an open-source project, download source files, write a small patch and that's it. The truth will require knowledge of C and an understanding of how the Redis protocol is arranged (in fact, it is very simple). Then you collect your binar. - ruby astari
tiaan willemse
As far as I know, Redis does not know how. Therefore, there are alternatives:
 - not to give open access to Redis, but to provide services (quite a laborious task and perhaps unnecessary, but more correct, since there is no dependence on the backend; in fact, everything depends on the task)
 - patch Redis (easier first, but there will be problems if the patch is not accepted: you have to support this feature with pens)
 - set up time synchronization using NTP-client (the simplest, but if there is no root, then it cannot be done)
ellen richard
Per-second synchronization is almost impossible to accomplish. there will definitely be some lining.
How can I patch radishes?
Replies:
Well, why, NTP bangs everything very well, here is a quote from link, for example:
In version 4, it can reach an accuracy of 10 ms (1/100 s) when working via the Internet, and up to 0.2 ms (1/5000 s ) and better inside LANs
NTP even gives a gain in accuracy, since the package with the “event number 1”, which occurred before the “event number 2”, can arrive later on the server with Redis. Because of this, the real chronology of events will be lost, and the chronology of the arrival of packages will be recorded. - jill zitzewitz
That's why you need a timestamp. - theresa musni
Why? Do you need a chronology of the incident or chronology of the arrival of the package on the server? Here is the situation, event1 occurred in server N seconds. On server2 event2 occurred in N+1 seconds. But the packet from the first server, got stuck somewhere, got lost or some other misfortune happened and it came in N+2 seconds. And from the second server, event2 arrived instantly (in a fraction of seconds, to be more precise). In the event that the timestamps are set up by the sending servers, the events are recorded chronologically in the correct order, even if the event1 comes later than the event2. In case the timestamp is set by the recipient server, event 2 will be recorded chronologically before event 1. If per second accuracy is so important to you, then the second case is unacceptable. - wenhsiu
Help identify the database or file format :: Reviews of old games? :: Profile on Habré? :: Monetization of Android applications :: How much does a Python-developer work to a distributed team cost?
Leave Repply forRedis. How to write to the key TimeStamp from the server where the Redis-server is running?
Useful Links