Example usage for org.springframework.data.redis.core RedisCallback RedisCallback

List of usage examples for org.springframework.data.redis.core RedisCallback RedisCallback

Introduction

In this page you can find the example usage for org.springframework.data.redis.core RedisCallback RedisCallback.

Prototype

RedisCallback

Source Link

Usage

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

/**
 * Get size of hash at {@code key}.//ww  w. jav a2  s.c o  m
 * 
 * @see http://redis.io/commands/hlen
 * @param key key
 * @return Long
 */
public static Long hLen(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hLen(key);
        }
    });
}

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

/**
 * Get size of hash at {@code key}./* w  w w  . j  a v  a 2 s.c  om*/
 * 
 * @see http://redis.io/commands/hlen
 * @param key key
 * @return Long
 */
public Long hLen(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hLen(key);
        }
    });
}

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

/**
 * Get key set (fields) of hash at {@code key}.
 * //from  w w  w .  j  av  a2  s.  c  o m
 * @see http://redis.io/commands/h?
 * @param key key
 * @return Set<byte[]>
 */
public static Set<byte[]> hKeys(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hKeys(key);
        }
    });
}

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

/**
 * Get key set (fields) of hash at {@code key}.
 * // w w w . j a v  a2 s .co  m
 * @see http://redis.io/commands/h?
 * @param key key
 * @return Set<byte[]>
 */
public Set<byte[]> hKeys(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Set<byte[]>>() {
        @Override
        public Set<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hKeys(key);
        }
    });
}

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

/**
 * Get entry set (values) of hash at {@code field}.
 * /*from  w ww .  ja  v a  2  s  . co m*/
 * @see http://redis.io/commands/hvals
 * @param key key
 * @return List<byte[]>
 */
public static List<byte[]> hVals(byte[] key) {
    return redisTemplate.execute(new RedisCallback<List<byte[]>>() {
        @Override
        public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hVals(key);
        }
    });
}

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

/**
 * Get entry set (values) of hash at {@code field}.
 * /*from w  w  w  .  j  a  va 2s .co  m*/
 * @see http://redis.io/commands/hvals
 * @param key key
 * @return List<byte[]>
 */
public List<byte[]> hVals(byte[] key) {
    return redisTemplate.execute(new RedisCallback<List<byte[]>>() {
        @Override
        public List<byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hVals(key);
        }
    });
}

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

/**
 * Get entire hash stored at {@code key}.
 * //from w  ww  . j  a  va 2  s . c  o m
 * @see http://redis.io/commands/hgetall
 * @param key key
 * @return Map
 */
public static Map<byte[], byte[]> hGetAll(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Map<byte[], byte[]>>() {
        @Override
        public Map<byte[], byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hGetAll(key);
        }
    });
}

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

/**
 * Get entire hash stored at {@code key}.
 * /*from   ww w .  j a va 2  s  .  com*/
 * @see http://redis.io/commands/hgetall
 * @param key key
 * @return Map
 */
public Map<byte[], byte[]> hGetAll(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Map<byte[], byte[]>>() {
        @Override
        public Map<byte[], byte[]> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hGetAll(key);
        }
    });
}

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

/**
 * Use a {@link Cursor} to iterate over entries in hash at {@code key}.
 * /*from   w ww  .ja  v  a 2 s  .c om*/
 * @since 1.4
 * @see http://redis.io/commands/scan
 * @param key key
 * @param options options
 * @return Cursor
 */
public static Cursor<Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options) {
    return redisTemplate.execute(new RedisCallback<Cursor<Entry<byte[], byte[]>>>() {
        @Override
        public Cursor<Entry<byte[], byte[]>> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hScan(key, options);
        }
    });
}

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

/**
 * Use a {@link Cursor} to iterate over entries in hash at {@code key}.
 * /*  w w w .  j av a  2 s. c  o m*/
 * @since 1.4
 * @see http://redis.io/commands/scan
 * @param key key
 * @param options options
 * @return Cursor
 */
public Cursor<Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options) {
    return redisTemplate.execute(new RedisCallback<Cursor<Entry<byte[], byte[]>>>() {
        @Override
        public Cursor<Entry<byte[], byte[]>> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hScan(key, options);
        }
    });
}