php - PHPRedis - time() does not work -


I have a problem.

In my project I have some servers that modify the same data in radis. All servers may have different times In other words, in some cases the app server can not trust the timing.

So I would like to use the redis time as the normal base point.

Everything can be alright, the PHPRedis documentation says that there is a function what I really want:.

But here's a big surprise:

  // Create connections etc ... var_dump ($ redis- & gt; time ());   

The output is:

  bool (false)   

The question is - what is it? Do you ever face such a problem?

How can I retrieve the server time using my work?

Note: Other radis functions work fine, I am able to read and write data is fine and properly created.

No help found here.

As well as anywhere else.

So I need to invent a wararound ...

It is, if anyone needs it

  // unique floating key Generate $ key = uniqid () post (); // Some random future TS $ future_ts = time () + 1000; $ Redis- & gt; Setx ($ key, time (), 5); $ Redis- & gt; Expired ($ key, $ future_ts); // This variable is now in which I have $ redis_ts = $ future_ts - $ redis- & gt; TTL ($ key) is required;    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -