Example usage for org.springframework.data.redis.connection RedisConnection time

List of usage examples for org.springframework.data.redis.connection RedisConnection time

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisConnection time.

Prototype

@Nullable
Long time();

Source Link

Document

Request server timestamp using TIME command.

Usage

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Request server timestamp using {@code TIME} command.
 * /*from   w  w  w .  ja  v  a2  s  .  co m*/
 * @return current server time in milliseconds.
 * @since 1.1
 */
public static Long time() {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.time();
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Request server timestamp using {@code TIME} command.
 * /*from  w  ww.  ja v  a  2s .co  m*/
 * @return current server time in milliseconds.
 * @since 1.1
 */
public Long time() {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.time();
        }
    });
}