S
S
SCINER2011-07-01 09:27:04
PHP
SCINER, 2011-07-01 09:27:04

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

It's a simple task, but I couldn't find the answer on the Internet.
The Redis server is written to from other sites on the Internet using php-rediska.
The date set on these sites naturally cannot be trusted. Second-to-second accuracy is important.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kastigar, 2011-07-01
@SCINER

And about patching Redis, if you still decide, here is a description of the protocol . You need to create a special kind of argument, with placeholders. I would add, $PLACEHOLDERit turns out that if after $ there is a numeric value, then this is the length of the value and we read it from a new line (that is, as it happens now). If the $ is followed by a non-numeric string, then this is a placeholder. In this case, it could be $TIMESTAMP, which says that the argument is the current timestamp. This will also allow more placeholders to be added in the future (can't think of any though). If you need more flexibility, you can use placeholders directly in values, for example, something like %TIMESTAMP%, but this will make the code backwards incompatible.
PS I would still look towards NTP :)

K
kastigar, 2011-07-01
@kastigar

As far as I know, Redis doesn't do this. Therefore, there are such alternatives:
- do not give open access to Redis, but provide services (a rather time-consuming task and perhaps superfluous, but more correct, since there is no dependence on the backend; in fact, everything depends on the task)
- patch Redis (easier than the first, but there will be problems if the patch is not accepted: you will have to support such a feature with handles)
- set up time synchronization using an NTP client (the easiest, but if there is no root, then it is impossible to do)

S
SCINER, 2011-07-01
@SCINER

Synchronization per second is almost impossible to do. There will definitely be some overlays.
How can you patch a radish?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question