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

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

Introduction

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

Prototype

@Nullable
Long append(byte[] key, byte[] value);

Source Link

Document

Append a value to key .

Usage

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

public Integer append(K key, String value) {
    final byte[] rawKey = rawKey(key);
    final byte[] rawString = rawString(value);

    return execute(new RedisCallback<Integer>() {

        public Integer doInRedis(RedisConnection connection) {
            connection.select(dbIndex);/*from  w ww  .  ja v  a 2  s .com*/
            final Long result = connection.append(rawKey, rawString);
            return (result != null) ? result.intValue() : null;
        }
    }, true);
}

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

/**
 * Append a {@code value} to {@code key}.
 * <p>//from  w  w  w. j ava  2s . c o m
 * See http://redis.io/commands/append
 * 
 * @param key must not be {@literal null}.
 * @param value value
 * @return Long
 */
public static Long append(byte[] key, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.append(key, value);
        }
    });
}

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

/**
 * Append a {@code value} to {@code key}.
 * <p>//from   w  ww  .  ja  v a  2 s  .com
 * See http://redis.io/commands/append
 * 
 * @param key must not be {@literal null}.
 * @param value value
 * @return Long
 */
public Long append(byte[] key, byte[] value) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.append(key, value);
        }
    });
}