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

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

Introduction

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

Prototype

@Nullable
Boolean hExists(byte[] key, byte[] field);

Source Link

Document

Determine if given hash field exists.

Usage

From source file:com.mauersu.util.redis.DefaultHashOperations.java

public Boolean hasKey(K key, Object hashKey) {
    final byte[] rawKey = rawKey(key);
    final byte[] rawHashKey = rawHashKey(hashKey);

    return execute(new RedisCallback<Boolean>() {

        public Boolean doInRedis(RedisConnection connection) {
            connection.select(dbIndex);//from   ww  w. ja v a 2 s. c o  m
            return connection.hExists(rawKey, rawHashKey);
        }
    }, true);
}

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

/**
 * Determine if given hash {@code field} exists.
 * //from  w  ww .  j  ava  2 s .  co  m
 * @see http://redis.io/commands/hexits
 * @param key key
 * @param field field
 * @return Boolean
 */
public static Boolean hExists(byte[] key, byte[] field) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hExists(key, field);
        }
    });
}

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

/**
 * Determine if given hash {@code field} exists.
 * //from   w  ww . j  ava  2 s. c  o m
 * @see http://redis.io/commands/hexits
 * @param key key
 * @param field field
 * @return Boolean
 */
public Boolean hExists(byte[] key, byte[] field) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.hExists(key, field);
        }
    });
}