0

Ok.I found the Redis's System service command is TIME,and I can use this command to get the system time of Redis server.

But I can't find the same command in the Jedis.

In the java, How do I get the system time of the Redis server?

And the TIME command return the Multi-bulk reply,How do I get the value of TIME,and using it in my Java client?

If you have the example,Thanks very much!

bnPYSse
  • 397
  • 4
  • 12

1 Answers1

2

Ok,I have a solution is:

Object o = jedis.eval("return redis.call('time')[1]"); Log(TAG,"o-->"+o.toString());

it can get the system time of the Redis server!

bnPYSse
  • 397
  • 4
  • 12
  • You are using LUA to do this. A small optimization can be added if you are interested: try using evalsha with a SHA1 created from your script first. If redis knows the script, it will execute it without sending the content of the script, if not it will throw an exception that you can catch and then send the content (first call). – zenbeni Nov 04 '13 at 12:26